Skip to content

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

Prerequisites

Step 1: Create a Service Account

  1. Go to the project you created for use with Nylas.
  2. In the search bar, type Service Accounts.
  3. On the screen that opens, click CREATE SERVICE ACCOUNT.
  4. Give the account the name nylas-gmail-realtime. The name, nylas-gmail-realtime, is required for the integration to work.
  5. Leave Grant this service account access to project (optional) and Grant users access to this service account (optional) blank.
  6. Click Done.

Step 2: Create Pub/Sub Topic

  1. In the search bar look for pub sub and select Pub/Sub.
  2. Click CREATE TOPIC.
  3. Enter the topic ID nylas-gmail-realtime, and leave the defaults checked. The topic ID listed is required for the integration to work.
  4. On the next page, click SHOW INFO PANEL, if it’s not already open.
  5. In the panel click ADD PRINCIPAL.
  6. Add the principal [email protected].
  7. Set the role to Pub/Sub Publisher.
  8. On save you should be directed to the Topics page.
  9. On the Topics page find the Subscriptions section. Click nylas-gmail-realtime-sub.
  10. Click the subscription, then click edit.
  11. Change the following:
    1. Delivery type: Push
    2. Endpoint URLhttps://<CUSTOMER>realtime.us.nylas.com
    3. Select Enable Authentication and choose the service account you made in Create a Service Account.
  12. When prompted, grant the roles/iam.serviceAccountTokenCreator to your service account.
  13. Leave the other fields as default and click Update.
  14. 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.