We need to use push notifications for many users, using watch Gmail API call.
The watch response we should get on the webhook does not contain any information about the user for which the webhook has been called.
The problem is that according to Users.history: list I cannot get messages without user-id.
How am I supposed to get user-id from the watch webhook? OR Is it possible to call something similar to "Users.history: list" without the need to have user-id?
Thanks for your support, Adrien
Edit from info in link in comment
If you check the Push Notifications you will see that the response from the server contains a data field.
// This is the actual notification data, as base64url-encoded JSON.
data: "eyJlbWFpbEFkZHJlc3MiOiAidXNlckBleGFtcGxlLmNvbSIsICJoaXN0b3J5SWQiOiAiMTIzNDU2Nzg5MCJ9",
The HTTP POST body is JSON and the actual Gmail notification payload is in the message.data field. That message.data field is a base64url-encoded string that decodes to a JSON object containing the email address and the new mailbox history ID for the user:
{"emailAddress": "[email protected]", "historyId": "9876543210"}
Data contains the email address of the user.
Note I don't have the power to test this I am just reading the documentation. I don't have a server set up to retrieve these notifications.