Only show these results:

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 gmail-api-push@system.gserviceaccount.com.
  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 URL: https://gmailrealtime.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 gmail-api-push@system.gserviceaccount.com for Google Pub/Sub to work.

Step 3: Add the Topic Name to Your Dashboard

Before adding the Topic name, we need to enable Google Pub/Sub for your application.

  1. Go to App Settings.
  2. At the end of the URL add ?experiments=64b58f9f-661c-4dc3-9de8-2248070687dc:1. The final URL should look similar to: https://dashboard.nylas.com/applications/app-id/settings/general?experiments=64b58f9f-661c-4dc3-9de8-2248070687dc:1. The page will refresh.
  3. Next, click on the Authentication tab and go to Google Auth. There is a new input added called GCP Topic Name. Input the topic created in Create a Pub/Sub Topic, for example, projects/nylas-test/topics/nylas-gmail-realtime.
  4. That's it, your app should be ready for real-time sync of Gmail messages.