Webhook response when updates happen in evernote - evernote

I am using evernote with my application, with webhooks. If any updates happen in note, I will get a response in query params like
"guid": "045d3f4e-3b5a-4096-8d03-09dba59ac606",
"notebookGuid": "58f761a8-dfbb-4387-986e-2a82db3a4fc3",
"reason": "update",
"userId": "602849"
With this data I am unable to get current updated information.
Can anyone suggest how to resolve my problem. Quick help is needed. Thanks in advance.

If you want the latest note, use NoteStore#getNote with the guid you got from the webhook.

Related

Firebase Log-in events

I want to see Who and When login to the Firebase from UI side, as administrator.
It is not related data access from app etc.
So, I login to https://firebase.google.com/ as User/Manager/Admin and want to see it in logs.
It should be in GCP project related to firebase, if so how can I find it - did saw in Log explorer.
Or it should be in Firebase UI?
thank you in advance.
I would give you a workaround. You can use Firebase Management API which is in beta.
Consider you have to watch a project.
You can make a request like below to get the Project Details.
GET https://firebase.googleapis.com/v1beta1/projects/{YourProjectID}
Sample Response:
{
"projectId": "*****************",
"projectNumber": "*****************",
"displayName": "Sample App",
"name": "projects/*****************",
"resources": {
"hostingSite": "*****************",
"realtimeDatabaseInstance": "*****************"
},
"state": "ACTIVE",
"etag": "1_d15ff4d3-727e-431c-8eba-f33957805f23"
}
In the response, you have a key called ETAG. Basically, this changes whenever the project is opened by someone.
You cannot get who is logged-in or other details.
You can only know someone has opened, changed or made some operations in the project, using ETAG.
You can simply store the ETAG in your server and poll for the change.
If it is changed, then someone might have used the Project.
If you want the Updated Time of the project along with it, you can try this,
https://cloud.google.com/resource-manager/reference/rest/v3/projects/get

How to get other member's profile details from linkedin api

I am trying to fetch users details from linkedIn api. After generating accesstoken I can get my details from linkedIn api but I want to get other members details. How to get this work? please help me.
I have tried the solutions according to the documentation.
As per the documentation we have to sent a get request to the GET https://api.linkedin.com/rest/people/(id:{person ID}) to Retrieve Other Member's Profile. When I am sending the get request it is showing me
data: {
code: 'VERSION_MISSING',
message: 'A version must be present. Please specify a version by adding the LinkedIn-Version header.'
}
this error. after searching the documentation I found that there is a note saying
in order to make the sample calls above succeed, you must include
X-RestLi-Protocol-Version:2.0.0 in your request header.
I have added that to and still getting the error.
I experienced the same issue. After some browsing this works for me:
Use https://api.linkedin.com/v2/me instead of https://api.linkedin.com/rest/me
You need to pass the version number like this: LinkedIn-Version: 202210. It worked for me without changing /rest to /v2. More info here: Introducing API Versioning and New Content APIs.
I had the same problem.
As the error says, I tried using LinkedIn-Version as the header key and got:
{
"code": "INVALID_VERSION",
"message": "API versions should have date format as YYYYMM or YYYYMM.RR where RR is the revision"
}
With the header value being: 2.0.0
So I tried sending as value: 202201.01 ==> YYYY=2022, MM=01, RR=01
YYYY: year
MM: month
RR: revision
Obtaining:
{
"code": "NONEXISTENT_VERSION",
"message": "Requested version 20220101 is not active"
}
Trying some different dates and revision codes, I got to value = 202204.01 that gave me:
{
"serviceErrorCode": 100,
"code": "ACCESS_DENIED",
"message": "Not enough permissions to access: me.GET.20220401"
}
I'm also facing the same issue but you can use this
https://api.linkedin.com/v2/me
and it will work
This version worked for me: 202204.01
Then I got:
"code": "EMPTY_ACCESS_TOKEN",
"message": "Empty oauth2 access token"
Which I think can be fixed by getting the access token by implementing the 3-legged OAuth. I have successfully implemented that for getting someone's profile but I am doing this for getting org info

Telegram `setTyping` API call

I'm trying to set my bot's typing status by sending the following POST request (based on the API docs):
https://api.telegram.org/bot{{botToken}}/setTyping
{
peer: {{chat_id}},
typing: true,
action: 'sendMessageTypingAction'
}
I've tried a few variations of it, such as changing the url to be /messages.setTyping and sending the action as {"_":"sendMessageTypingAction"} as seen here, but all I get is:
{
"ok": false,
"error_code": 404,
"description": "Not Found: method not found"
}
Anyone know what I'm doing wrong?
Thanks to #tashakori for pointing me in the right direction towards the Bot API. For posterity, what I needed to do was:
https://api.telegram.org/bot{{botToken}}/sendChatAction
{
chat_id: {{chatId}},
action: 'typing'
}
The link you have mentioned above belongs to Telegram Core APIs which is used for handling ordinary accounts of Telegram. These so-called Core APIs are not related to Telegram Bot APIs.
The only API that is somehow similar to SetTyping for bots is AnswerCallbackQuery, which can be used only when responding to the user's interaction with inline keyboards. (you can send a text to the user, saying that there is a process running in the background and whenever the user's answer is ready, you can send it using APIs like sendMessage)

How to receive update if someone blocks Facebook Messenger Bot?

So I have created Messenger bot. Is there a way to receive webhook when someone who was interacting with bot has blocked it? Similar to how you can set up webhook when someone uninstalls facebook app.
When a user first interacts with the bot I store his information in the database. If he decides to block the bot, I want to delete that row from the database so receiving messenger_id would be completely enough.
I read through FB docs but did not find anything useful. Would appreciate if someone could help.
You will receive an error code when you try to message the user from your bot. Probably something similar to this:
{
"error": {
"message": "This Person Cannot Receive Messages: This person isn't receiving messages from you right now.",
"type": "OAuthException",
"code": 10,
"error_subcode": 2018108,
"fbtrace_id": "BLBz/WZt8dN"
}
}
Try going through your response logs finding that user PSID to see the exact error you are getting, but it should be very similar to the above.
So what you have to do is update the user when you get a response like this consistently, perhaps set a counter or build a rule for when you decide is enough to remove the user form your DB or disable. More info on the errors here:
https://developers.facebook.com/docs/messenger-platform/reference/send-api/error-codes

Accessing YouTube API in Meteor project for logged in user

I'm working on a new Meteor project which involves users logging into the site using their Google accounts through OAuth (I'm using the Meteor accounts-google package for this) and when signing in I need them to be able to see some data from the YouTube Analytics API for their YouTube channel. As of now the data I am trying to get is their total daily views, which I then hope to display on a chart for a specified time period.
I have added the following scopes to my accounts-google login system:
Meteor.loginWithGoogle({
requestPermissions: ['https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/yt-analytics.readonly', 'https://www.googleapis.com/auth/youtube.readonly'],
requestOfflineToken: true,
forceApprovalPrompt: true,
loginStyle: "popup"
});
This all seems to be working very well, once a user signs into the site and grants the site access to these I can then see the necessary info in my MongoDB database. Under user.services.google I can now see it has accessToken, idToken, expiresAt, refreshToken, etc.
I've also decided to use the google api nodejs client by implementing it through the meteorhacks:npm package for Meteor. I am using this to refresh tokens (as seen in this SO answer I found helpful).
Using the "Try It" API Explorer on the YouTube Analytics API Documentation page, I can get the type of data I'm looking for through this request:
GET https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DMINE&start-date=2015-10-01&end-date=2015-10-31&metrics=views&dimensions=day&sort=-day&key={YOUR_API_KEY}
Now is where I've been completely stuck and really unsure of where to go from here. How can I implement this into my site? I've tried for quite some time now to make this work but everything I attempt isn't working, and there's no real direction. If anyone is willing to help out I'd greatly appreciate it. I'm fairly new to Meteor/JS/APIs so any information/examples is extremely appreciated, especially noob friendly stuff! ;)
One way to do it is to use a method and the http package: https://atmospherejs.com/meteor/http
Looking at the doc you provide, you may try something like this:
Define your method on the server side
// server-side
Meteor.methods({
getYoutubeReports: function(channelId, accessToken, params) {
params.ids = "channel=="+ channelId;
params.key = accessToken;
return HTTP.get("https://www.googleapis.com/youtube/analytics/v1/reports", {
params: params
});
}
});
You can then call it on the client side with the data you get from your the authentication (ie. CHANNEL_ID_OF_MY_USER & ACCESS_TOKEN_OF_MY_USER)
// client-side
var reports,
myParams = {
"start-date": "2015-10-01",
"end-date": "2015-10-31",
"metrics": "views",
"dimensions": "day",
"sort": "-day"
};
Meteor.call('getYoutubeReports', CHANNEL_ID_OF_MY_USER, ACCESS_TOKEN_OF_MY_USER, params, function(error, result) {
// store or do stuff with the result of the HTTP request here
console.log(result);
});
Feel free to custom myParams as your user need!
And if you want to some more tips about how to use HTTP request (really useful to call external API), The Meteor Chef wrote a really good article about it : https://themeteorchef.com/snippets/using-the-http-package/
I hope it helps!
I ended up using the percolate:google-api package to handle my API call.

Resources