Setting Up Gmail Webhooks Integration: 4 Easy Steps

By: Published: November 8, 2021

Gmail Webhook - Featured image

E-Mail is a revolutionary way to communicate with people! It has had a huge impact on society, through how humans communicate. It has reduced the use of traditional mail and has been instrumental in creating an entirely new system of communication. For example, many people have all their bills and payments delivered through E-Mail instead of the post office. A study by The Radicati Group, Inc. concludes that E-Mail has replaced 92% of written letters as a means of personal communication. One of the most popular E-Mail services is Gmail.

Gmail is a free E-Mail service provided by Google that gives you various features like Automatic E-Mail Filtering, Smart Reply, E-Mail Nudges, etc. Although Gmail works perfectly, it is usually recommended to have Gmail Webhook Integration for your account. Gmail Webhook Integration enhances the features of Gmail and gives you the ability to Push Notifications for a specific event(s).

This article will introduce you to Gmail Webhooks Integration. It will also provide you with a comprehensive guide that will help you integrate Gmail API Webhook manually.

Table of Contents


Given below are the prerequisites for setting up Gmail Webhooks Integration:

Introduction to Gmail

Gmail logo
Image Source

Gmail, in simple terms, is an E-Mail service provided by Google for free of cost. With Gmail, you can send and receive E-Mails, and perform other basic E-Mail related tasks like creating an address book, blocking spam, etc. It is one of the most popular and widely used online E-Mail services in the world. 

Key Features of Gmail

Following are some of the key features of Gmail:

  • It is possible to get your Gmail address even if you don’t have a Google Account. For example, you can sign in to Gmail using your Yahoo, Hotmail, or any other E-Mail address.
  • Gmail gives you 1 GB of free storage space which you can use for sending and receiving E-Mails. 
  • Gmail connects to Google Sites which gives you privacy-conscious options for keeping your E-Mails. 
  • You have the option of using POP3 or IMAP4 protocol in Gmail. POP3 is available when you are connected to the Internet, but IMAP4 is available when you are not connected to the Internet. 
  • You can click on the “Forward” button in your E-Mail to send it to another folder, create a new message in regards to an existing message or an attachment.

For more information on Gmail and its features, click here.

Introduction to Webhooks

Webhooks logo
Image Source

Webhooks, in simple terms, are one of the ways that applications use to interact with each other. They send automated notifications (in real-time) whenever a given event occurs. Webhooks are now a standard feature used by many different services, such as Gmail, GitHub, Slack, etc.

Suppose you have an application that tracks when a person checks into your restaurant. Now, that you have such an application, you want to trigger a specific event when someone enters or leaves your restaurant. With Webhooks, you get a notification when someone checks in or out of your restaurant. You can this to your advantage and set your application to trigger a particular event when that happens. Given below is a stripped-down view of Webhooks in action.

Webhooks in Action image
Image Source

For more information on Webhooks, click here.

Simplify E-Mail Analysis using Hevo’s No-code Data Pipeline

Hevo Data, a No-code Data Pipeline helps to Load Data from any data source such as Databases, SaaS applications, Cloud Storage, SDKs, and Streaming Services and simplifies the ETL process. It supports 100+ data sources and is a 3-step process by just selecting the data source, providing valid credentials, and choosing the destination. Hevo loads the data onto the desired Data Warehouse, enriches the data, and transforms it into an analysis-ready form without writing a single line of code.

Its completely automated pipeline offers data to be delivered in real-time without any loss from source to destination. Its fault-tolerant and scalable architecture ensure that the data is handled in a secure, consistent manner with zero data loss and supports different forms of data. The solutions provided are consistent and work with different Business Intelligence (BI) tools as well.

Get Started with Hevo for free

Check out why Hevo is the Best:

  • Secure: Hevo has a fault-tolerant architecture that ensures that the data is handled in a secure, consistent manner with zero data loss.
  • Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  • Minimal Learning: Hevo, with its simple and interactive UI, is extremely simple for new customers to work on and perform operations.
  • Hevo Is Built To Scale: As the number of sources and the volume of your data grows, Hevo scales horizontally, handling millions of records per minute with very little latency.
  • Incremental Data Load: Hevo allows the transfer of data that has been modified in real-time. This ensures efficient utilization of bandwidth on both ends.
  • Live Support: The Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
  • Live Monitoring: Hevo allows you to monitor the data flow and check where your data is at a particular point in time.
Sign up here for a 14-day Free Trial!

Steps to Set Up Gmail Webhook Integration

Gmail Webhook Integration
Image Source

Now that you have a basic understanding of Webhooks and how they work, it is time for Gmail Webhook Integration and using it to your advantage. Gmail already has pre-installed Webhooks that usually provide you with Server Push Notifications. You can use Gmail Webhook Integration to overwatch the changes happening to your Gmail mailboxes.

Gmail Webhook Integration improves the performance of Gmail, eliminates the extra network, computes costs associated with polling resources, and determines the changes occurring in your Gmail account. Follow the steps below to set up Gmail Webhook Integration for your business:

Step 1: Create the Topic

Using your Cloud Pub/Sub client that you must have created as a prerequisite, create the topic that you want Gmail Webhook should send notifications to. There is no restriction on the topic name. You can have any topic name under your project. For instance, projects/myprojects/mytopic/*, where “myproject” is the Project ID.

NOTE: It is highly recommended to use a single topic for all your Gmail Webhook Push Notifications because Cloud Pub/Sub has a quota limit on the number of topics.

Step 2: Set Up a Subscription to the Topic

In this step, you need to set up a subscription to the topic you created in the last step. Click on the following link to get a detailed overview of setting up a subscription to the topic created. This is a necessary step because this is how your application will receive notifications for all future updates.

NOTE: Configure the subscription type to either of the following 2 options:

  • Webhook Push (i.e. HTTP POST Callback)
  • Webhook Pull (i.e. initiated by your application)

Step 3: Grant Gmail Privileges to your Topic

Cloud Pub/Sub requires Gmail privileges to publish notifications to your topic. More specifically, you need to grant Gmail Publish privileges to You can achieve this by using the Cloud Pub/Sub Developer Console following the Resource-Level Access Control Instructions that you check out via this link.

There are 3 options while granting access to Gmail privileges:

  • Access on a per-topic or per-subscription basis.
  • Access with limited abilities. For instance, only publish messages to a topic, only consume messages, etc.
  • Access to all Cloud Pub/Sub resources within a project.

Step 4: Configure Gmail Account to Send Notifications

Once you are done with the above steps, you need to configure your Gmail account to send notifications to your Cloud Pub/Sub topic. This can be done using the Gmail API Client to call watch() function. Given below is the sample code that you can use to configure your Gmail account to send notifications:

Content-type: application/json
  topicName: "projects/myproject/topics/mytopic",
  labelIds: ["INBOX"],

If the above code executes successfully, you will receive a response like this:

  historyId: 1234567890
  expiration: 1431990098200

NOTE: All the changes after the “historyId” that you will receive as a response, will be hereafter notified to you. Furthermore, it is very important to re-call watch() function at least every 7 days. Otherwise, you will stop receiving updates.

That’s it! You can successfully set up Gmail Webhook Integration and can effectively use it as a part of your business.


The article introduced you to Gmail Webhook Integration and also provided you with a comprehensive step-by-step guide to integrate Gmail trigger Webhook manually. With the complexity involved in Manual Integration, businesses are leaning towards Automated Integration. It is hassle-free, easy to operate, and does not require any technical background. In such a case Hevo Data is the right choice for you!

Visit our Website to Explore Hevo

Want to take Hevo for a spin? Sign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs.

Share your experience of setting up Gmail Webhook Integration in the comments section below!

Karan Singh Pokhariya
Former Research Analyst, Hevo Data

Karan has experience in driving strategic planning, and implementing data-driven initiatives. His experience spans strategic transition planning, data analysis for optimization, product development. His passion to data drives him write in-depth articles on data integration.

No-Code Data Pipeline for your Data Warehouse