eBuildfire: Notifications issue - mobile

I have created an app that uses push notifications to notify people about important events during their day. For a regular user, the app can create anywhere between 120 to 350 notifications every 7 days (we create all the notifications for the upcoming week). In some cases when users change their accounts, we are renewing the notification by canceling them and creating them again. This can happen 2 to 4 times in a span of a few minutes.
We had situations when the app users reported OLD notifications still being sent when those should have been canceled.
We tested this multiple times while adding logs for each notification that got canceled or added - and each time this worked ok - the logs matched the total we were expecting.
Is there a limitation to the number of notifications that can be canceled or added at one single time by the APP? Is there something that could break the requests?
Is there a way to see if the notifications got created or not, other than checking the response of the requests?
Thanks in advance!

Related

Clarification regarding gmail message apis

What is the Order in which the message list returns the messages. i.e message.list api? Whether it is based on the message timestamp or any other field.
If I want to sync a very large mailbox and I fire a message.list api, then I get a pageToken for pagination, so how long is the pageToken valid? For eg if I get a page token X and I fire the api to fetch the next page after 6-7 hours will I still get the expected response.
As this pageToken validity is not mentioned in the gmail api doc, any approach on how can full mail sync be done if the service which is syncing the mailbox restarts.
If I remember correctly the order of returned emails is "newest first, to older ones". I don't believe a pageToken would expire in 6-7 hours but why would you wait for so long to get the next page? If you care about getting new emails a few hours later then you want to use the history methods, starting with startHistoryId that you get from your full load.

what exactly does the Gmail API push notification rate limit mean?

I'm building a messaging system for GCP-hosted platform and plan to use Gmail as a backing system. Users can write their messages through our system which will invoke Gmail API to send emails to other recipients. When someone responds, Gmail API sends a push notification and our system in turn notifies a used.
As I expect high spikes of user activity, the limitation of 1 notification per second (https://developers.google.com/gmail/api/guides/push):
Each Gmail user being watched has a maximum notification rate of 1 event/sec. Any user notifications above that rate will be dropped.
doesn't seem to work for me. But to be sure I want to understand what does it exactly mean.
In particular:
what will happen if my mailbox receive 100 emails in a second? Will Gmail generate a single notification which will include all 100 messages? Or there will be several notifications generated which will eventually notify me about all messages? Or due to high messages rate and the above-mentioned limit of 1 notification per second I will receive a single notification for the first message and the rest 99 will not be pushed to my backend?
What the documentation tells you is that, if 100 notifications appear on the same user on gmail at the same time, the first notification would come thru, then the other 99 would be dropped.
However, there is a way to recover changes by using history events, this is referred to as sync and there are multiple ways to do this. I suggest you read up on the Partial Synchronization guide.
The documentation also offers some advice on how you should architect your code to deal with this, specially in the Reliability section of the documentation.

How do I monitor gmail API usage from Microsoft Flow?

I have used Microsoft Flow to check for new emails with specific labels using their gmail connector trigger 'when a new email arrives'.
Up until now I have had four flows running perfectly for over a year, until last Friday when errors started occurring. I am now testing with just one flow, single concurrency, which runs every minute (Flow Plan 2). The mailbox being checked receives at most 200 new messages per day, fairly spread out.
This is the error message which happens after the flow runs sucessfully 2-3 times a minute apart:
{
"statusCode": 403,
"message": "Out of call volume quota. Quota will be replenished in 23:01:41."
}
Microsoft claim this is related to the gmail API limit of no more than 60 calls per 60 seconds, even though the message above suggests a refresh of the quote in something close to 24 hours. It seems more like we are hitting some kind of daily limit, but the only one I could find on the gmail usage limits page is for 1,000,000 quota units per day, and I'm certain we are far short of that.
I have tried accessing quota usage from https://console.developers.google.com but since I didn't make a project and everything is setup from the Microsoft flow, there is no quota data shown.
Q: How can I verify the number of api calls being made from Microsoft Flow via the gmail connector, if that's even possible?
Note, I also started a thread on the Microsoft Power users forum to get help, but I figure if it's gmail API related then I may get better answers here.
Edit 27th Aug: Resolution was to export the flows to a new microsoft account. For whatever reason, the flows run fine on the new account (even though it has the same flow subscription). Microsoft still cannot explain why the flows would halt on one account and not on another.

Google Calendar API: error «Calendar usage limits exceeded»

Problems
As part of my task to provide the ability to manage events via the Google Calendar API. Events use two groups of guests (attendees):
- Group 1 is Google accounts with alternative mail from the same domain (for example site.com)
- Group 2 is person with email all around the world.
This may be a conference call with the participation of 3-10 people, and the annual meeting of about 100 guests. On all events there can be representatives from both groups.
But I am faced with a restriction on the use of the API, which does not allow us to accomplish this task. I managed to find out the cause of this error and reduce the data to analyze the problem to a minimum.
Workflow and mechanism
Group 1: Each Google Calendar user is a separate personal Google account with setting “Alternative emails” from the same domain. They have an additional shared calendar for these events, with email notification enabled.
Group 2: This is person with email all around the world, that may have an Google Calendar Account or do not, which are used as the Guest ID for the event.
The organizer (group 1) has an authorized valid access token. He creates an event with a the list of guests. As the guest ID is used Calendar_ID account.
At first, the event was successfully saved correctly and the notification was received for external participants successfully, without errors. But after several repetitions of creating events similar in parameters, an error began to occur. I get the Calendar usage limits exceeded error:
{"error": {"errors": [{"domain": "usageLimits", "reason": "quotaExceeded", "message": "Calendar usage limits exceeded."}], "code": 403, "message ":" Calendar usage limits exceeded. "}}
Although if you save the event only for yourself in own calendar_id without any participants, the following error does not occur!
I have processed enough materials and similar problems from sites:
- https://developers.google.com/calendar/support
- https://stackoverflow.com/questions/tagged/google-calendar-api
- https://productforums.google.com/forum/#!forum/calendar
There are several pages indicating a similar problem, but there are no specific solutions or workarounds.
And I see only one real reason for the appearance of such a restriction:
https://support.google.com/a/answer/2905486?hl=en
"Sending too many invitations or emails to external guests". Perhaps I have reached this limit of 100-300. But what to do with it?
Additional investigation
For the tests I have created a completely new test environment:
1. A separate Google user has been created as an organizer, with his own calendar and additional calendar.
2. Created a separate Google user as a guest for the event, with your calendar and additional calendar
3. All creation of events was used via web calendar.google.com interface.
As result:
- An additional attendee's calendar has reached the limit after creating the 4th event, within 5 minutes
- The main calendar - after creating the 15th event, within 15 minutes
I got a restriction that I should try to create an event later. Perhaps there is some kind of limiter on the frequency of creating/updating an event, but nowhere is this mantioned.
With a break of 4 hours, I was able to create only 5 events for the main calendar, I could not add an additional event to the additional calendar due to an error.
Questions
1. How do I get around these calendar blocking restrictions? In addition, all guests receive this event as desired and are clearly ready to confirm receipt of such events (subscribe to events from certain organizers).
Is it possible to perform this task using G Suite solution or another similar?
Could you please provide me with some an extended documentation on the API of the Calendar about:
conditions for calendar limitation exceeded (I have not found these criterias for using the API of the Calendar on the official website and pages of official forums)
time to unlock to save/update the event, after the occurrence of "Calendar usage limits"
Thanks in advance for your rapid reply as soon as possible.
Based from this support page:,
Calendar usage limits exceeded. This is the result of an API call. (Don't mix this up with the message "Daily quota exceeded," which points to insufficient API quota.)
It also means that the user reached one of the Google Calendar limits in place to protect Google users and infrastructure from abusive behavior. (Reference.)
Suggested actions:
Read more on the Calendar usage limits in the G Suite Administrator help.
If one user is making a lot of requests on behalf of many users of a G Suite domain, consider using a Service Account with authority delegation (setting the quotaUser parameter).
Use exponential backoff.

How does Trello show users online/offline/idle state accurately?

Trello shows the information of online/offline/idle status very accurately as I personally saw. There are several solutions for tracking users online statuses, and to do so accurately requires a serious overhead. There are also the traditional problems of not knowing if a user closed the browser, disconnected etc. that cause inaccuracy in showing the offline/idle status. For a platform that does not have chat functionality (which, I believe, which would have taken the overhead of tracking users' status and therefore makes the task finally easy) how is Trello achieving this, albeit without much overhead?
Also Trello is able to detect disconnects and resume connection (not so smoothly though).
The Pushing and Polling layer of Trello is described here
Each browser tab is considered to be a session, associated with one user. Each session's activity level is tracked separately, with a user being shown with the highest activity level of all of its sessions (where active is highest, then idle, then disconnected).
Each tab periodically sends its current status to the server - every minute if it has a working WebSocket, every 5 minutes otherwise. Current status is reset to active every time the tab gains focus, or there is a keydown or mousedown event. It goes idle if it has been more than 5 minutes since the most recent of those events. The tab sends a status of disconnected in the onunload event, but we don't depend on this.
Every time a session sends its status to the server, the server looks at all of that user's sessions to determine whether that indicates a change to the user's status. If it does, it broadcasts that new status to every person watching every board that user is on (this goes through the same framework that the rest of Trello's instant updates go through, and is too complicated to explain here).
The server also checks each session to see if its been too long since we've heard from that session (2 minutes if its a WebSocket session, 10 minutes otherwise) and removes the session if it has been (removing a session indicates it is disconnected).
There are a couple of optimizations hiding in there, but that's the main story.
Trello using socket.io.. so when ever a user login it broadcast a message that user has logged in , then they show him as online.
Once he disconnects they send a message on socket again to show him offline.
Many realtime apps using socket.io for showing realtime activities.

Resources