Google Pub/Sub for Message Sync
If you want to sync data between Gmail and Nylas even faster, you can use Google Pub/Sub for real-time syncing of Gmail messages. This guide will take you through the set up process.
- An existing Google app connected to your Nylas application.
Go to the project you created for use with Nylas.
In the search bar, type Service Accounts.
On the screen that opens, click CREATE SERVICE ACCOUNT.
Give the account the name
nylas-gmail-realtime, is required for the integration to work.
Leave Grant this service account access to project (optional) and Grant users access to this service account (optional) blank.
- In the search bar look for pub sub and select Pub/Sub.
- Click CREATE TOPIC.
- Enter the topic ID
nylas-gmail-realtime, and leave the defaults checked. The topic ID listed is required for the integration to work.
- On the next page, click SHOW INFO PANEL, if it's not already open.
- In the panel click ADD PRINCIPAL.
- Add the principal
- Set the role to Pub/Sub Publisher.
- On save you should be directed to the Topics page.
- On the Topics page find the Subscriptions section. Click
- Click the subscription, then click edit.
- Change the following:
- Delivery type: Push
- Endpoint URL:
- Select Enable Authentication and choose the service account you made in Create a Service Account.
- When prompted, grant the
roles/iam.serviceAccountTokenCreatorto your service account.
- Leave the other fields as default and click Update.
- After saving, it will take you back to the Subscription page. Copy the Topic Name for the next step.
The topic name must be
nylas-gmail-realtime. The principal must use the email
[email protected] for Google Pub/Sub to work.
Before adding the Topic name, we need to enable Google Pub/Sub for your application.
- Go to App Settings.
- Click on the Authentication tab and go to Google Auth. There is a input called GCP Topic Name. Input the topic created in Create a Pub/Sub Topic, for example,
- Repeat steps one and two for every Nylas app you would like real-time Gmail message sync for.
- You can use the same Pub/Sub topic for all your Nylas apps.