Gmail Integration
Email and contact management with Gmail integration for CrewAI.
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 Enterprise 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
- Navigate to CrewAI Enterprise Integrations
- Find Gmail in the Authentication Integrations section
- Click Connect and complete the OAuth flow
- Grant the necessary permissions for email and contact management
- Copy your Enterprise Token from Account Settings
2. Install Required Package
Available Actions
GMAIL_SEND_EMAIL
GMAIL_SEND_EMAIL
Description: Send an email in Gmail.
Parameters:
toRecipients
(array, required): To - Specify the recipients as either a single string or a JSON array.from
(string, required): From - Specify the email of the sender.subject
(string, required): Subject - Specify the subject of the message.messageContent
(string, required): Message Content - Specify the content of the email message as plain text or HTML.attachments
(string, optional): Attachments - Accepts either a single file object or a JSON array of file objects.additionalHeaders
(object, optional): Additional Headers - Specify any additional header fields here.
GMAIL_GET_EMAIL_BY_ID
GMAIL_GET_EMAIL_BY_ID
Description: Get an email by ID in Gmail.
Parameters:
userId
(string, required): User ID - Specify the user’s email address. (example: “user@domain.com”).messageId
(string, required): Message ID - Specify the ID of the message to retrieve.
GMAIL_SEARCH_FOR_EMAIL
GMAIL_SEARCH_FOR_EMAIL
Description: Search for emails in Gmail using advanced filters.
Parameters:
emailFilterFormula
(object, optional): A filter in disjunctive normal form - OR of AND groups of single conditions.Available fields:from
,to
,date
,label
,subject
,cc
,bcc
,category
,deliveredto:
,size
,filename
,older_than
,newer_than
,list
,is:important
,is:unread
,is:snoozed
,is:starred
,is:read
,has:drive
,has:document
,has:spreadsheet
,has:presentation
,has:attachment
,has:youtube
,has:userlabels
paginationParameters
(object, optional): Pagination Parameters.
GMAIL_DELETE_EMAIL
GMAIL_DELETE_EMAIL
Description: Delete an email in Gmail.
Parameters:
userId
(string, required): User ID - Specify the user’s email address. (example: “user@domain.com”).messageId
(string, required): Message ID - Specify the ID of the message to trash.
GMAIL_CREATE_A_CONTACT
GMAIL_CREATE_A_CONTACT
Description: Create a contact in Gmail.
Parameters:
givenName
(string, required): Given Name - Specify the Given Name of the Contact to create. (example: “John”).familyName
(string, required): Family Name - Specify the Family Name of the Contact to create. (example: “Doe”).email
(string, required): Email - Specify the Email Address of the Contact to create.additionalFields
(object, optional): Additional Fields - Additional contact information.
GMAIL_GET_CONTACT_BY_RESOURCE_NAME
GMAIL_GET_CONTACT_BY_RESOURCE_NAME
Description: Get a contact by resource name in Gmail.
Parameters:
resourceName
(string, required): Resource Name - Specify the resource name of the contact to fetch.
GMAIL_SEARCH_FOR_CONTACT
GMAIL_SEARCH_FOR_CONTACT
Description: Search for a contact in Gmail.
Parameters:
searchTerm
(string, required): Term - Specify a search term to search for near or exact matches on the names, nickNames, emailAddresses, phoneNumbers, or organizations Contact properties.
GMAIL_DELETE_CONTACT
GMAIL_DELETE_CONTACT
Description: Delete a contact in Gmail.
Parameters:
resourceName
(string, required): Resource Name - Specify the resource name of the contact to delete.
GMAIL_CREATE_DRAFT
GMAIL_CREATE_DRAFT
Description: Create a draft in Gmail.
Parameters:
toRecipients
(array, optional): To - Specify the recipients as either a single string or a JSON array.from
(string, optional): From - Specify the email of the sender.subject
(string, optional): Subject - Specify the subject of the message.messageContent
(string, optional): Message Content - Specify the content of the email message as plain text or HTML.attachments
(string, optional): Attachments - Accepts either a single file object or a JSON array of file objects.additionalHeaders
(object, optional): Additional Headers - Specify any additional header fields here.
Usage Examples
Basic Gmail Agent Setup
Filtering Specific Gmail Tools
Contact Management
Email Search and Analysis
Automated Email Workflows
Getting Help
Need Help?
Contact our support team for assistance with Gmail integration setup or troubleshooting.