Add web hook for inbox emails to company gmail account

3.7k views Asked by At

How can I integrate email inbox from company account to my application? Gems like mail_room or gmail can connect to one mailbox given that you specify them.

I'm thinking about a web hook like a notification api, but I can't figure out how it works.

How can I add a web hook for inbox emails in company's gmail account? When a message is received in [email protected] or [email protected] I need to have a notification sent.

1

There are 1 answers

0
ReyAnthonyRenacia On

Check the Push Notifications for Gmail API.

1.Initial Cloud Pub/Sub Setup

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.

Prerequisites

In order to complete the rest of this setup, make sure you fulfill the Cloud Pub/Sub Prerequisites and then set up a Cloud Pub/Sub client.

Create a topic

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).

We recommend that you use a single topic for all Gmail API push notifications for your application, due to Cloud Pub/Sub limits on the number of topics.

Create a subscription

Follow the Cloud Pub/Sub Subscriber Guide to set up a subscription to the topic that you created. Configure the subscription type to be either a webhook push (i.e. HTTP POST callback) or pull (i.e. initiated by your app). This is how your application will receive notifications for updates.

more on the guide for additional info.