I have successfully configured Google Pub / Sub to use the Gmail API viewer, as described here: https://developers.google.com/gmail/api/guides/push to view the INBOX shortcut in my gmail.
When a new message arrives, I instantly receive a push notification in a valid format, for example:
{ message: { data: '.......', attributes: {}, message_id: '1248700053943' }, subscription: '.....' }
After I received the base64decode data, I received the email and historyId. Then, as suggested, I request the gmail.users.history.list API (via the API console) using startHistoryId set to historyId from the push notification. And then you get only an empty answer without any details:
GET https://www.googleapis.com/gmail/v1/users/me/history?startHistoryId=4658879&key={YOUR_API_KEY} 200 OK - Show headers { "historyId": "4658894" }
Therefore, the historyId from the notification does not appear to be valid. It looks like the Gmail users.watch API is not working correctly and sending the wrong ID history, or am I just missing something?
google-api gmail-api google-cloud-pubsub
Yaroslav pogrebnyak
source share