Bociek
Bociek

Reputation: 1265

gmail push notifications from different accounts into single cloud pub/sub

I know that it is possible to send gmail messages to cloud pub/sub using watch options in gmail API. That is great! But, I have 4 different gmail accounts and I would like all them to push notifications into a single cloud pub/sub so that I can consume them with cloud functions and redistributed among slack channels (no, it cannot be done separately on each account since the billing is controlled only by one of them. It can also be external clients gmails which obviously won't pay for that.). Any option to push notifications into single cloud pub/sub?

Upvotes: 0

Views: 446

Answers (1)

Alex Mordkovich
Alex Mordkovich

Reputation: 144

You can configure the notifications from all four gmail accounts to be sent to the same Cloud Pub/Sub topic. From the documentation:

Using your Cloud Pub/Sub client, create the topic that the Gmail API should send notifications to. The topic name can be any name you choose under your project (i.e. matching projects/myproject/topics/*, where myproject is the Project ID listed for your project in the Google Developers Console).

You can then send watch() requests on each of the four accounts, specifying the same topicName.

Upvotes: 1

Related Questions