Using the GMail API how can I see if an account has an existing watch on it? - api

I am trying to add a watch to an existing gmail account via the Gmail API but am getting the error:
Only one user push notification client allowed per developer (call /stop then try again)
How can I check to see if the gmail account already has a watch on it?

Unfortunately, the Gmail API does not have a method that allows you to detect if an account already has a watch applied to it. You can always renew a watch by first stopping the watch and then immediately initiate a new watch right after.
Best practice is to store watch expiration time when you initialize a watch and always check against the stored expiration timestamp to determine if a watch needs to be renewed.

Related

How can we get a warning when the request per second pass a certain limit. (Quotas of Cognito AWS)

Our web application is using UserAuthentication Cognito, there is a problem that arises when a lot of users authenticate in 1 second. We want to limit the Quotas if possible and have a warning when it exceeds a certain amount to prevent system overloading. We haven't found a solution to this problem yet.
Can you help us solve this problem? Maybe with some example code or a return response containing content of message and place of error log whenever it breaks the limit.
You can try using cloudwatch alarms to send notifications when certain quotas are being exceeded. This notification can be directly sent to your app to perform further actions.
If your app cannot recieve notifications, you can use the alarm to trigger a lamdba which updates a database. You can then create a pre authentication lambda trigger that will query this database before logging user in.
Here's the documentation for cognito cloudwatch alarms: https://docs.aws.amazon.com/cognito/latest/developerguide/tracking-quotas-and-usage-in-cloud-watch-and-service-quotas.html

Cloudkit new record notification

I am about ready to update my app with CloudKit new record notifications. before I publish it should I delete the subscription I used to test it?
You can delete it, yes. But if you are asking this question, you might be overlooking something with subscriptions.
I always create CloudKit subscriptions programmatically in my app when it starts up (through a method called from didFinishLaunchingWithOptions). I set a static name for the notification like taskNotification for each recordType so that the same subscription gets overwritten with each app launch.
This is useful because this code will run for every user on every device so that their devices gets registered to receive the notifications.
It also ensures the subscriptions get created in the Production environment on CloudKit after you migrate to it.
If you are manually creating and deleting CloudKit subscriptions, you may not be allowing your users to subscribe their devices properly. Just thought I'd point that out.
Good luck!

Dropbox API finding new/changed files

I'm trying to setup a webhook from dropbox to notify my server whenever a new file is uploaded.
There are 1000's of files being shared but < 100 everyday and I only want to find the new files of a certain type that have been added or modified since the last check.
The webhook sends the userid when the file is added but doesn't indicate a file name.
Is there anyway using the list_folder api, or using another api to find out what file has been changed since a certain date?
Dropbox webhooks only tell you that something changed, but not what specifically changed.
You can use these in conjunction with /2/files/list_folder[/continue] to see what changed. The webhooks documentation and the Content Access Guide have more information about this.
In short, the basic flow would be like this:
The user connects the app to their account, and the app saves the resulting access token for that user.
The app gets the current state of the account using /2/files/list_folder[/continue], and stores the latest returned cursor.
The user makes changes in their account.
Dropbox notifies the app of changes in the user's account using a webhook notification.
The app receives the webhook notification and looks up the corresponding access token and cursor for the specified user.
The app calls /2/files/list_folder/continue using the cursor to retrieve only what changed since it last called, and again stores the latest returned cursor.
(Repeat)

Yodlee webhooks not hitting my URL

I have been reading Yodlee Docs at https://developer.yodlee.com/Yodlee_API/Webhooks for implementing webhooks
What i did is, first registered a webhook for one of my users using following end point
POST /{cobrandName}/v1/cobrand/config/notifications/events/{eventName}
Then i triggered a refresh for one of the account using following endpoint POST /{cobrandName}/v1/refresh
But seems that Yodlee doesnt hit my URL when refresh is completed or there is an error in refresh.
I also tried to add an account using FastLink to see if Yodlee hits my URL when an account is added. But it doesn't. I am not sure what exactly is the problem. Can you please help?
Although i have a dobt - Does the webhook hit only if add/edit/refresh account was done using the API and not FastLInk provided by yodlee?
I am using Account Agreegation API and Developer account for testing.
Webhook event notifications will work only when you try to add the account using YSL APIs (manually).It doesn't work with FastLink. I have been informed by Yodlee Support. They also informed me that till date they don't have any client using webhook service, which was bit scary to know.
Please find a simple example to use webhooks-
1)Subscribe event using this URL- http://webhook.info/post/FLQLMZMFJI
2)Initiate add account process
3)Open the following URL and find the refresh notifications -
http://webhook.info/#/watch/FLQLMZMFJI
Please note: As you have subscribed for webhook event now. Please unsubscribe first using
DELETE /{cobrandName}/v1/cobrand/config/notifications/events/{eventName}
Delete Subscription

send notification to a particular user with notification hub - Azure and GCM

I am a software developer in Xamarin - Android, I want to create notification messages. For this purpose I use Azure notification hub, combined with Google's service - Google Cloud Messaging (GCM).
My problem comes when I want to send notification to a particular user. I realized that I need to use the "TAGS" When I compose a new user to the system (Uniqe TAG)
Indeed, it works great, but when the user logged off his account, and then connect to another one (with another TAGS) - the TAGS of his old account are kept in a certain time, and he continues to receive personal messages from the previous account!!!!
Does anyone know what can be done about it?
thank you very much
This is actually an issue a lot of people/apps have on iOS and Android.
What you should do is:
Register your app at your Azure Notification Hub (ANH) on first start and reregister at every app start, to keep registration in sync
If a user logs in, update the registration with an additional tag for this user (e.g. "user:XY")
Sending notifications to that user tag will of course result in notifications on all devices the user is logged in on
If a user logs out, update the registration without the user tag (omit the user tag, so the registration doesn't have user tag anymore afterwards)
The registration will be updated immediately on ANH and sending notifications to the user (tag) will not result in notifications on that specific client
If the user can logout on your app without internet connection, you won't be able to update the registration of course and you will still have the problem of getting notifications for a logged out user. But as soon as another user logs in, the registration should get updated with the new user tag and everything should be fine again...
What you shouldn't do:
"Developers should never unregister the client app as a mechanism for logout or for switching between users..."