This guide explains how to set up Google Cloud Pub/Sub (Pub/Sub) for Aurinko to receive push notifications from the Gmail API. Using Pub/Sub eliminates the need for constant polling of your Gmail inbox for updates, improving efficiency.

To get started, head over to https://console.developers.google.com. You will be prompted to log in with a Google account if you’re not already logged in with one.

Select your project, or create a new one. Refer to this article if creating a new project, the Gmail API needs to be enabled!

Pub/Sub topic setup

  1. Head over to the Pub/Sub page

    Image Placeholder

  2. Create a new topic. The default options will do:

    Image Placeholder

  3. Copy the topic name and enter it in your Aurinko app settings:

    Image Placeholder

  4. Back in the Google Developer console, edit the default subscription that was created for your new topic. Make it a Push subscription with the following ‘Endpoint URL’: https://{yourAurinkoDomain}/push/google/email

    Image Placeholder

    Also, change the retry policy and save:

    Image Placeholder

  5. Go back to the ‘Topics’ menu and click ‘View permissions’ for your new topic.

    Image Placeholder

  6. Now, let’s grant Gmail privileges to publish notifications to your topic.

    Click ‘ADD PRINCIPLE’ and grant publish privileges to gmail-api-push@system.gserviceaccount.com:

Image Placeholder

You are done!