I'm using the Gmail API (With the Google Cloud Platform) to send push notifications to my server. This mailbox is never actually accessed by a user, it only exists for the purpose of sending push notifications to a route on my server that retrieves the latest email from the mailbox.
Everyday, I have a cron job that renews the Users: watch()
on this email address. It's only one email address associated with a single topic in the Cloud Console with one push
subscription to my server. My controller then calls Users.messages: list
to get a list of recent emails, followed by Users.messages: get
to get the most recent email with all attachment IDs/filenames, and finally Users.messages.attachments: get
to get each data for each attachment.
I've noticed that when I send emails with lots of attachment data (25 Mb of image data for instance), I start receiving a series of push notifications, each with the same message_id
and timestamp in the data sent with the push notification POST request. For now, I'm dealing with this by saving the message_id
in a cache for a little while to prevent my server from reacting to a single push notification more than once.
Although my solution works nicely, I'm curious if anyone else has experienced a problem like this, or whether this is a bug in the Gmail API or Cloud Platform. Any help or advice is appreciated!