Gmail

Gmail offers private and secure email by Google at no cost, for business and consumer accounts.

Go to site

Gmail API Integrations

Build and run workflows using the Gmail API. Use 1000s of source-available triggers and actions across 2,200+ apps. Or write custom code to integrate any app or API in seconds.

Trusted by 1,000,000+ developers from startups to Fortune 500 companies

Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo
Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo

Overview

By connecting your personal Gmail account to Pipedream, you'll be able to incorporate email into whatever you're building with any of the thousands of apps that are available on Pipedream.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { axios } from "@pipedream/platform"
export default defineComponent({
  props: {
    gmail: {
      type: "app",
      app: "gmail",
    }
  },
  async run({steps, $}) {
    return await axios($, {
      url: `https://www.googleapis.com/oauth2/v1/userinfo`,
      headers: {
        Authorization: `Bearer ${this.gmail.$auth.oauth_access_token}`,
      },
    })
  },
})

Choose an API to Connect with Gmail API

1
-
24
of
2,200+
apps by most popular

HTTP / Webhook
HTTP / Webhook
Get a unique URL where you can send HTTP or webhook requests
Node
Node
Anything you can do with Node.js, you can do in a Pipedream workflow. This includes using most of npm's 400,000+ packages.
Python
Python
Anything you can do in Python can be done in a Pipedream Workflow. This includes using any of the 350,000+ PyPi packages available in your Python powered workflows.
OpenAI (ChatGPT)
OpenAI (ChatGPT)
OpenAI is an AI research and deployment company with the mission to ensure that artificial general intelligence benefits all of humanity. They are the makers of popular models like ChatGPT, DALL-E, and Whisper.
Premium
Salesforce
Salesforce
Web services API for interacting with Salesforce
Premium
HubSpot
HubSpot
HubSpot's CRM platform contains the marketing, sales, service, operations, and website-building software you need to grow your business.
Premium
Zoho CRM
Zoho CRM
Zoho CRM is an online Sales CRM software that manages your sales, marketing, and support in one CRM platform.
Premium
Stripe
Stripe
Stripe powers online and in-person payment processing and financial solutions for businesses of all sizes.
Shopify
Shopify
Shopify is a complete commerce platform that lets anyone start, manage, and grow a business. You can use Shopify to build an online store, manage sales, market to customers, and accept payments in digital and physical locations.
Premium
WooCommerce
WooCommerce
WooCommerce is the open-source ecommerce platform for WordPress.
Premium
Snowflake
Snowflake
A data warehouse built for the cloud
Premium
MongoDB
MongoDB
MongoDB is an open source NoSQL database management program.
Supabase
Supabase
Supabase is an open source Firebase alternative.
MySQL
MySQL
MySQL is an open-source relational database management system.
PostgreSQL
PostgreSQL
PostgreSQL is a free and open-source relational database management system emphasizing extensibility and SQL compliance.
Premium
AWS
AWS
Amazon Web Services (AWS) offers reliable, scalable, and inexpensive cloud computing services.
Premium
Twilio SendGrid
Twilio SendGrid
Send marketing and transactional email through the Twilio SendGrid platform with the Email API, proprietary mail transfer agent, and infrastructure for scalable delivery.
Amazon SES
Amazon SES
Amazon SES is a cloud-based email service provider that can integrate into any application for high volume email automation
Premium
Klaviyo
Klaviyo
Email Marketing and SMS Marketing Platform
Premium
Zendesk
Zendesk
Zendesk is award-winning customer service software trusted by 200K+ customers. Make customers happy via text, mobile, phone, email, live chat, social media.
Notion
Notion
Notion is a new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team.
Slack
Slack
Slack is a channel-based messaging platform. With Slack, people can work together more effectively, connect all their software tools and services, and find the information they need to do their best work — all within a secure, enterprise-grade environment.
Microsoft Teams
Microsoft Teams
Microsoft Teams has communities, events, chats, channels, meetings, storage, tasks, and calendars in one place.
Schedule
Schedule
Trigger workflows on an interval or cron schedule.

Getting Started

To connect your Gmail account to Pipedream, just accept the prompt when connecting your Gmail account. To connect your account with your own OAuth client, see below.

Configuring a Gmail OAuth client in Google Cloud Platform

To get started, you'll need the following:

  • A Google Cloud account
  • Basic familiarity with Google Cloud Console

Quickstart

  1. Create a custom Gmail client in Google Cloud Console
  2. Enable Gmail API and Pub/Sub API
  3. Create OAuth credentials and a service account
  4. Set up a custom OAuth client in Pipedream
  5. Connect your Gmail account using the custom client and service account

For detailed instructions, follow the steps below.

Detailed Setup Instructions

1. Create a Gmail app

  1. Sign in to the Google Cloud Console

  2. Select an existing project, or create a new one

    Select an existing project or create a new one in the Google Cloud Console

  3. Select APIs & Services

  4. Click Enable APIs & Services

    Select "Enable APIs & Services to open a menu to enable the Gmail API for Pipedream to connect to

  5. Search for and select Gmail API

  6. Click Enable

    Search for and select the Gmail Enterprise API

  7. Search for and select Cloud Pub/Sub API

  8. Click Enable

    Search for and select the Cloud Pub/Sub API

Note: If you encounter issues with API enablement, ensure you have the necessary permissions in your Google Cloud project.

2. Set up the OAuth consent screen

  1. Click OAuth consent screen on the left side

    Click "OAuth consent screen" in the left navigation menu

  2. Set up the OAuth consent screen:

    • Select User Type (Internal for Google Workspace users, External for others)
    • Fill in required fields
    • Add scopes: email, profile, https://www.googleapis.com/auth/gmail.modify, https://www.googleapis.com/auth/gmail.settings.basic
    • Add your email as a test user
    • Review and complete the setup

    Select "External" in the OAuth Consent Screen

3. Create OAuth Credentials in Google and Custom OAuth Client in Pipedream

  1. Navigate to the Credentials section on the left side.

    Open the Credentials menu in the left hand nav bar

  2. Click Create Credentials at the top and select OAuth client ID

    Click create credentials to start the process

    Select the OAuth Client ID option

  3. Select Web application for Application type

    Web application is the type of OAuth credential we're generating

  4. Name the app, e.g. "Pipedream".

  5. In a new window, navigate to the Accounts page in Pipedream, and click OAuth Clients.

    Custom OAuth Client creation on Pipedream

  6. Click New OAuth Client, and search for Gmail.

  7. Name your OAuth Client, and click Continue.

  8. Copy the Redirect URI, and return to your previous window.

  9. On your Google Cloud app configuration page, click Add URI and paste the Redirect URI from the previous step.

    Add the Pipedream URL to the Callback Redirect URL option

  10. Click Create to create your new OAuth keys.

    Store the Client ID and Client Secret keys

  11. Copy the Client ID and Client Secret, and paste them in your OAuth Client configuration on Pipedream.

    Custom OAuth Client creation on Pipedream

Important: When creating the OAuth client ID, make sure to copy the Redirect URI from Pipedream exactly as shown to avoid authentication errors.

4. Create service account

  1. Navigate to Credentials under APIs & Services, and click Create Credentials > Service Account.

    Service Account Creation

  2. Add a name and description for your service account, and grant the service account the role Pub/Sub Admin, and click Done.

    Role administering

  3. Click on the service account that you created, and click Keys > Add Key > Create New Key > JSON. This will download the service account JSON credentials to your computer. Be sure to save this securely.

    Create private key

5. Connect your Gmail account in Pipedream

  1. From the Pipedream Accounts page, click OAuth Clients. Next to your newly created Gmail client, click the three-dot menu on the righthand side and click Connect Account. Or you can also connect your account from the workflow builder, when configuring the Gmail trigger.
  2. While configuring the New Email Received trigger, you should be prompted to input your Service Account Key JSON.

6. Publish your custom Gmail app (required for External app type only)

Google has a 7 day expiration window on refresh tokens for External applications with a publishing status of "Testing", so you will need to Publish your application in order to maintain your account connection.

  1. Navigate to your application, and click OAuth Consent Screen on the lefthand sidebar.
  2. Under Publishing status, click Publish App. If you included any sensitive or restricted scopes in your app, there will be a disclosure stating that you will need to go through the process of verification. Click Confirm.
  3. Your application will not be available externally unless you share your client_id with others, and you will not have to go through the verification process unless you intend to onboard over 100 users.
  4. The publishing status should be set to In production, and your account should maintain its connection without an expiration window.

Publish your application

Confirmation of changes

Send Email with Gmail API on New Requests from HTTP / Webhook API
HTTP / Webhook + Gmail
 
Try it
Send Email with Gmail API on New Email Received from Gmail (Developer App) API
Gmail (Developer App) + Gmail
 
Try it
Remove Label from Email with Gmail API on New Item in Feed from RSS API
RSS + Gmail
 
Try it
Remove Label from Email with Gmail API on New Message (Instant) from Discord API
Discord + Gmail
 
Try it
Remove Label from Email with Gmail API on New Message In Channels (Instant) from Slack API
Slack + Gmail
 
Try it
New Attachment Received from the Gmail API

Emit new event for each attachment in a message received. This source is capped at 100 max new messages per run.

 
Try it
New Email Matching Search from the Gmail API

Emit new event when an email matching the search criteria is received. This source is capped at 100 max new messages per run.

 
Try it
New Email Received from the Gmail API

Emit new event when a new email is received.

 
Try it
New Labeled Email from the Gmail API

Emit new event when a new email is labeled.

 
Try it
New Sent Email from the Gmail API

Emit new event for each new email sent. (Maximum of 100 events emited per execution)

 
Try it
Add Label to Email with the Gmail API

Add label(s) to an email message. See the docs

 
Try it
Create Draft with the Gmail API

Create a draft from your Google Workspace email account. See the documentation

 
Try it
Download Attachment with the Gmail API

Download an attachment by attachmentId to the /tmp directory. See the documentation

 
Try it
Find Email with the Gmail API

Find an email using Google's Search Engine. See the docs

 
Try it
Remove Label from Email with the Gmail API

Remove label(s) from an email message. See the docs

 
Try it

Troubleshooting

  • Authentication Failed: Double-check that your Redirect URI is correct and that you've added your email as a test user in the OAuth consent screen.
  • API Not Enabled: Ensure both Gmail API and Pub/Sub API are enabled in your Google Cloud project.
  • Service Account Issues: Verify that your service account has the "Pub/Sub Admin" role and that you've correctly pasted the JSON key into Pipedream.

If you continue to experience issues, please contact Pipedream support for further assistance.

Authentication

Name Slug: gmail

Gmail uses OAuth authentication. When you connect your Gmail account, Pipedream will open a popup window where you can sign into Gmail and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Gmail API.

Pipedream requests the following authorization scopes when you connect your account:

emailprofileopenidhttps://www.googleapis.com/auth/gmail.labelshttps://www.googleapis.com/auth/gmail.sendhttps://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/gmail.composehttps://www.googleapis.com/auth/gmail.settings.basic
OAuth Request Configurations:
  1. authorization
    GEThttps://accounts.google.com/o/oauth2/auth?client_id={{oauth.client_id}}&state={{oauth.state}}&redirect_uri={{oauth.redirect_uri}}&response_type=code&scope={{oauth.space_separated_scopes}}&access_type=offline&prompt=consent
  2. accessToken
    POSThttps://oauth2.googleapis.com/tokencontent-type: application/x-www-form-urlencodedaccept: application/json
    client_id={{oauth.client_id}}&client_secret={{oauth.client_secret}}&grant_type=authorization_code&code={{oauth.code}}&redirect_uri={{oauth.redirect_uri}}
  3. refreshToken
    POSThttps://oauth2.googleapis.com/tokencontent-type: application/x-www-form-urlencodedaccept: application/json
    client_id={{oauth.client_id}}&client_secret={{oauth.client_secret}}&grant_type=refresh_token&refresh_token={{oauth.refresh_token}}

Trusted by 1,000,000+ developers from startups to Fortune 500 companies

Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo
Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo