user2129794
user2129794

Reputation: 2418

Google Pubsub Subscription based on particular email id

I am relatively new to GCP platform. I need to create a system wherein my team gets notifications whenever an email is received from there client.

I have to create a system which is publishing messages in pubsub topic filtered by email id.

example : I want to publish only those message/emails in which "To" and "From" fields has "[email protected]"

I have referred the online documentations but could not find the workaround. Is this possible using GCP? If not is there any other service via which I can achieve the same ?

We are using Gmail as the email client

Thanks

Upvotes: 0

Views: 1055

Answers (1)

aga
aga

Reputation: 3883

What you can use, is Pub/Sub together with Cloud Functions, which enables to access Gmail programmatically. Your specific scenario could look as following:

  1. User sets up Gmail push notifications: every time a new message arrives at inbox, Gmail will send a notification to Cloud Pub/Sub.
  2. Cloud Pub/Sub delivers the new message notification to Google Cloud Functions.
  3. Upon arrival of the new message notification, a Cloud Functions instance connects to Gmail and retrieves the new message.
  4. Check who send the message, and perform specific actions.

Before setting up a Cloud Function to automatically read your emails, you must authorize its access to Gmail. Have a look for codelab scenario and see step by step how to perform specific actions and adjust the function for your needs. Additionally, you can take a look for official documentation here.

Upvotes: 1

Related Questions