Configuring Pub/Sub for Gmail API Webhooks

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

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

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

  1. 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/{clientId}

Also, change the retry policy and save:

  1. Go back to the 'Topics' menu and click 'View permissions' for your new topic.

  1. 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:

You are done!

Last updated