I'm familiar with the concepts of push notification with Gmail and 'webhooks' in general. My question is - is there a way to get push notifications about all Gmail Users Emails that are related to the same Gsuite Account? I know that there is a way to get global token by Perform G Suite Domain-Wide Delegation of Authority but I can't find enough info about how to listen to all user's emails and if it's even possible.
Asked
Active
Viewed 665 times
1 Answers
1
The Gmail API uses the Cloud Pub/Sub API to deliver push notifications. This allows notification via a variety of methods including webhooks and polling on a single subscription endpoint.
POST "https://www.googleapis.com/gmail/v1/users/me/watch"
Content-type: application/json
{
topicName: "projects/myproject/topics/mytopic",
labelIds: ["INBOX"],
}
Info on how to implement domain wide dedication

Linda Lawton - DaImTo
- 106,405
- 32
- 180
- 449
-
it seems that this require each user in the Gsuite account to approve my App and its scope permissions , and only after that i will be able to send a Watch request for each user in order to listen to his email changes. my purpose is to get [wide-access from the administrator][1] in order to get notifications about all the users emails, by once [1]: https://developers.google.com/admin-sdk/directory/v1/guides/delegation – Hen Bar Levi Dec 06 '17 at 14:23
-
You should be able to create a service account and have the admin grant it domain wide permissions. – Linda Lawton - DaImTo Dec 06 '17 at 14:33
-
1but will i be able to create a single Watch request that create push notification for all the users? because i need to send the userId/'me' parameter so it seems not possible – Hen Bar Levi Dec 06 '17 at 15:41