Skip to main content

Overview

Enable your agents to manage emails, contacts, and drafts through Gmail. Send emails, search messages, manage contacts, create drafts, and streamline your email communications with AI-powered automation.

Prerequisites

Before using the Gmail integration, ensure you have:
  • A CrewAI AMP account with an active subscription
  • A Gmail account with appropriate permissions
  • Connected your Gmail account through the Integrations page

Setting Up Gmail Integration

1. Connect Your Gmail Account

  1. Navigate to CrewAI AMP Integrations
  2. Find Gmail in the Authentication Integrations section
  3. Click Connect and complete the OAuth flow
  4. Grant the necessary permissions for email and contact management
  5. Copy your Enterprise Token from Integration Settings

2. Install Required Package

3. Environment Variable Setup

To use integrations with Agent(apps=[]), you must set the CREWAI_PLATFORM_INTEGRATION_TOKEN environment variable with your Enterprise Token.
Or add it to your .env file:

Available Actions

Description: Retrieve a list of messages.Parameters:
  • userId (string, required): The user’s email address or ‘me’ for the authenticated user. (default: “me”)
  • q (string, optional): Search query to filter messages (e.g., ‘from:someone@example.com is:unread’).
  • maxResults (integer, optional): Maximum number of messages to return (1-500). (default: 100)
  • pageToken (string, optional): Page token to retrieve a specific page of results.
  • labelIds (array, optional): Only return messages with labels that match all of the specified label IDs.
  • includeSpamTrash (boolean, optional): Include messages from SPAM and TRASH in the results. (default: false)
Description: Send an email.Parameters:
  • to (string, required): Recipient email address.
  • subject (string, required): Email subject line.
  • body (string, required): Email message content.
  • userId (string, optional): The user’s email address or ‘me’ for the authenticated user. (default: “me”)
  • cc (string, optional): CC email addresses (comma-separated).
  • bcc (string, optional): BCC email addresses (comma-separated).
  • from (string, optional): Sender email address (if different from authenticated user).
  • replyTo (string, optional): Reply-to email address.
  • threadId (string, optional): Thread ID if replying to an existing conversation.
Description: Delete an email by ID.Parameters:
  • userId (string, required): The user’s email address or ‘me’ for the authenticated user.
  • id (string, required): The ID of the message to delete.
Description: Create a new draft email.Parameters:
  • userId (string, required): The user’s email address or ‘me’ for the authenticated user.
  • message (object, required): Message object containing the draft content.
    • raw (string, required): Base64url encoded email message.
Description: Retrieve a specific message by ID.Parameters:
  • userId (string, required): The user’s email address or ‘me’ for the authenticated user. (default: “me”)
  • id (string, required): The ID of the message to retrieve.
  • format (string, optional): The format to return the message in. Options: “full”, “metadata”, “minimal”, “raw”. (default: “full”)
  • metadataHeaders (array, optional): When given and format is METADATA, only include headers specified.
Description: Retrieve a message attachment.Parameters:
  • userId (string, required): The user’s email address or ‘me’ for the authenticated user. (default: “me”)
  • messageId (string, required): The ID of the message containing the attachment.
  • id (string, required): The ID of the attachment to retrieve.
Description: Retrieve a specific email thread by ID.Parameters:
  • userId (string, required): The user’s email address or ‘me’ for the authenticated user. (default: “me”)
  • id (string, required): The ID of the thread to retrieve.
  • format (string, optional): The format to return the messages in. Options: “full”, “metadata”, “minimal”. (default: “full”)
  • metadataHeaders (array, optional): When given and format is METADATA, only include headers specified.
Description: Modify the labels applied to a thread.Parameters:
  • userId (string, required): The user’s email address or ‘me’ for the authenticated user. (default: “me”)
  • id (string, required): The ID of the thread to modify.
  • addLabelIds (array, optional): A list of IDs of labels to add to this thread.
  • removeLabelIds (array, optional): A list of IDs of labels to remove from this thread.
Description: Move a thread to the trash.Parameters:
  • userId (string, required): The user’s email address or ‘me’ for the authenticated user. (default: “me”)
  • id (string, required): The ID of the thread to trash.
Description: Remove a thread from the trash.Parameters:
  • userId (string, required): The user’s email address or ‘me’ for the authenticated user. (default: “me”)
  • id (string, required): The ID of the thread to untrash.

Usage Examples

Basic Gmail Agent Setup

Filtering Specific Gmail Tools

Email Search and Analysis

Thread Management

Getting Help

Need Help?

Contact our support team for assistance with Gmail integration setup or troubleshooting.