Google Contacts Integration
Overview
Section titled “Overview”Enable your agents to manage contacts and directory information through Google Contacts. Access personal contacts, search directory people, create and update contact information, and manage contact groups with AI-powered automation.
Prerequisites
Section titled “Prerequisites”Before using the Google Contacts integration, ensure you have:
- A CrewAI AMP account with an active subscription
- A Google account with Google Contacts access
- Connected your Google account through the Integrations page
Setting Up Google Contacts Integration
Section titled “Setting Up Google Contacts Integration”1. Connect Your Google Account
Section titled “1. Connect Your Google Account”- Navigate to CrewAI AMP Integrations
- Find Google Contacts in the Authentication Integrations section
- Click Connect and complete the OAuth flow
- Grant the necessary permissions for contacts and directory access
- Copy your Enterprise Token from Integration Settings
2. Install Required Package
Section titled “2. Install Required Package”uv add crewai-tools3. Environment Variable Setup
Section titled “3. Environment Variable Setup”export CREWAI_PLATFORM_INTEGRATION_TOKEN="your_enterprise_token"Or add it to your .env file:
CREWAI_PLATFORM_INTEGRATION_TOKEN=your_enterprise_tokenAvailable Actions
Section titled “Available Actions”google_contacts/get_contacts
Description: Retrieve user’s contacts from Google Contacts.
Parameters:
pageSize(integer, optional): Number of contacts to return (max 1000). Minimum: 1, Maximum: 1000pageToken(string, optional): The token of the page to retrieve.personFields(string, optional): Fields to include (e.g., ‘names,emailAddresses,phoneNumbers’). Default: names,emailAddresses,phoneNumbersrequestSyncToken(boolean, optional): Whether the response should include a sync token. Default: falsesortOrder(string, optional): The order in which the connections should be sorted. Options: LAST_MODIFIED_ASCENDING, LAST_MODIFIED_DESCENDING, FIRST_NAME_ASCENDING, LAST_NAME_ASCENDING
google_contacts/search_contacts
Description: Search for contacts using a query string.
Parameters:
query(string, required): Search query stringreadMask(string, required): Fields to read (e.g., ‘names,emailAddresses,phoneNumbers’)pageSize(integer, optional): Number of results to return. Minimum: 1, Maximum: 30pageToken(string, optional): Token specifying which result page to return.sources(array, optional): The sources to search in. Options: READ_SOURCE_TYPE_CONTACT, READ_SOURCE_TYPE_PROFILE. Default: READ_SOURCE_TYPE_CONTACT
google_contacts/list_directory_people
Description: List people in the authenticated user’s directory.
Parameters:
sources(array, required): Directory sources to search within. Options: DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE, DIRECTORY_SOURCE_TYPE_DOMAIN_CONTACT. Default: DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILEpageSize(integer, optional): Number of people to return. Minimum: 1, Maximum: 1000pageToken(string, optional): Token specifying which result page to return.readMask(string, optional): Fields to read (e.g., ‘names,emailAddresses’)requestSyncToken(boolean, optional): Whether the response should include a sync token. Default: falsemergeSources(array, optional): Additional data to merge into the directory people responses. Options: CONTACT
google_contacts/search_directory_people
Description: Search for people in the directory.
Parameters:
query(string, required): Search querysources(string, required): Directory sources (use ‘DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE’)pageSize(integer, optional): Number of results to returnreadMask(string, optional): Fields to read
google_contacts/list_other_contacts
Description: List other contacts (not in user’s personal contacts).
Parameters:
pageSize(integer, optional): Number of contacts to return. Minimum: 1, Maximum: 1000pageToken(string, optional): Token specifying which result page to return.readMask(string, optional): Fields to readrequestSyncToken(boolean, optional): Whether the response should include a sync token. Default: false
google_contacts/search_other_contacts
Description: Search other contacts.
Parameters:
query(string, required): Search queryreadMask(string, required): Fields to read (e.g., ‘names,emailAddresses’)pageSize(integer, optional): Number of results
google_contacts/get_person
Description: Get a single person’s contact information by resource name.
Parameters:
resourceName(string, required): The resource name of the person to get (e.g., ‘people/c123456789’)personFields(string, optional): Fields to include (e.g., ‘names,emailAddresses,phoneNumbers’). Default: names,emailAddresses,phoneNumbers
google_contacts/create_contact
Description: Create a new contact in the user’s address book.
Parameters:
names(array, optional): Person’s names[{"givenName": "John","familyName": "Doe","displayName": "John Doe"}]emailAddresses(array, optional): Email addresses[{"value": "john.doe@example.com","type": "work"}]phoneNumbers(array, optional): Phone numbers[{"value": "+1234567890","type": "mobile"}]addresses(array, optional): Postal addresses[{"formattedValue": "123 Main St, City, State 12345","type": "home"}]organizations(array, optional): Organizations/companies[{"name": "Company Name","title": "Job Title","type": "work"}]
google_contacts/update_contact
Description: Update an existing contact’s information.
Parameters:
resourceName(string, required): The resource name of the person to update (e.g., ‘people/c123456789’)updatePersonFields(string, required): Fields to update (e.g., ‘names,emailAddresses,phoneNumbers’)names(array, optional): Person’s namesemailAddresses(array, optional): Email addressesphoneNumbers(array, optional): Phone numbers
google_contacts/delete_contact
Description: Delete a contact from the user’s address book.
Parameters:
resourceName(string, required): The resource name of the person to delete (e.g., ‘people/c123456789’)
google_contacts/batch_get_people
Description: Get information about multiple people in a single request.
Parameters:
resourceNames(array, required): Resource names of people to get. Maximum: 200 itemspersonFields(string, optional): Fields to include (e.g., ‘names,emailAddresses,phoneNumbers’). Default: names,emailAddresses,phoneNumbers
google_contacts/list_contact_groups
Description: List the user’s contact groups (labels).
Parameters:
pageSize(integer, optional): Number of contact groups to return. Minimum: 1, Maximum: 1000pageToken(string, optional): Token specifying which result page to return.groupFields(string, optional): Fields to include (e.g., ‘name,memberCount,clientData’). Default: name,memberCount
google_contacts/get_contact_group
Description: Get a specific contact group by resource name.
Parameters:
resourceName(string, required): The resource name of the contact group (e.g., ‘contactGroups/myContactGroup’)maxMembers(integer, optional): Maximum number of members to include. Minimum: 0, Maximum: 20000groupFields(string, optional): Fields to include (e.g., ‘name,memberCount,clientData’). Default: name,memberCount
google_contacts/create_contact_group
Description: Create a new contact group (label).
Parameters:
name(string, required): The name of the contact groupclientData(array, optional): Client-specific data[{"key": "data_key","value": "data_value"}]
google_contacts/update_contact_group
Description: Update a contact group’s information.
Parameters:
resourceName(string, required): The resource name of the contact group (e.g., ‘contactGroups/myContactGroup’)name(string, required): The name of the contact groupclientData(array, optional): Client-specific data[{"key": "data_key","value": "data_value"}]
google_contacts/delete_contact_group
Description: Delete a contact group.
Parameters:
resourceName(string, required): The resource name of the contact group to delete (e.g., ‘contactGroups/myContactGroup’)deleteContacts(boolean, optional): Whether to delete contacts in the group as well. Default: false
Usage Examples
Section titled “Usage Examples”Basic Google Contacts Agent Setup
Section titled “Basic Google Contacts Agent Setup”from crewai import Agent, Task, Crew
# Create an agent with Google Contacts capabilitiescontacts_agent = Agent( role="Contact Manager", goal="Manage contacts and directory information efficiently", backstory="An AI assistant specialized in contact management and directory operations.", apps=['google_contacts'] # All Google Contacts actions will be available)
# Task to retrieve and organize contactscontact_management_task = Task( description="Retrieve all contacts and organize them by company affiliation", agent=contacts_agent, expected_output="Contacts retrieved and organized by company with summary report")
# Run the taskcrew = Crew( agents=[contacts_agent], tasks=[contact_management_task])
crew.kickoff()Directory Search and Management
Section titled “Directory Search and Management”from crewai import Agent, Task, Crew
directory_manager = Agent( role="Directory Manager", goal="Search and manage directory people and contacts", backstory="An AI assistant that specializes in directory management and people search.", apps=[ 'google_contacts/search_directory_people', 'google_contacts/list_directory_people', 'google_contacts/search_contacts' ])
# Task to search and manage directorydirectory_task = Task( description="Search for team members in the company directory and create a team contact list", agent=directory_manager, expected_output="Team directory compiled with contact information")
crew = Crew( agents=[directory_manager], tasks=[directory_task])
crew.kickoff()Contact Creation and Updates
Section titled “Contact Creation and Updates”from crewai import Agent, Task, Crew
contact_curator = Agent( role="Contact Curator", goal="Create and update contact information systematically", backstory="An AI assistant that maintains accurate and up-to-date contact information.", apps=['google_contacts'])
# Task to create and update contactscuration_task = Task( description=""" 1. Search for existing contacts related to new business partners 2. Create new contacts for partners not in the system 3. Update existing contact information with latest details 4. Organize contacts into appropriate groups """, agent=contact_curator, expected_output="Contact database updated with new partners and organized groups")
crew = Crew( agents=[contact_curator], tasks=[curation_task])
crew.kickoff()Contact Group Management
Section titled “Contact Group Management”from crewai import Agent, Task, Crew
group_organizer = Agent( role="Contact Group Organizer", goal="Organize contacts into meaningful groups and categories", backstory="An AI assistant that specializes in contact organization and group management.", apps=['google_contacts'])
# Task to organize contact groupsorganization_task = Task( description=""" 1. List all existing contact groups 2. Analyze contact distribution across groups 3. Create new groups for better organization 4. Move contacts to appropriate groups based on their information """, agent=group_organizer, expected_output="Contacts organized into logical groups with improved structure")
crew = Crew( agents=[group_organizer], tasks=[organization_task])
crew.kickoff()Comprehensive Contact Management
Section titled “Comprehensive Contact Management”from crewai import Agent, Task, Crew
contact_specialist = Agent( role="Contact Management Specialist", goal="Provide comprehensive contact management across all sources", backstory="An AI assistant that handles all aspects of contact management including personal, directory, and other contacts.", apps=['google_contacts'])
# Complex contact management taskcomprehensive_task = Task( description=""" 1. Retrieve contacts from all sources (personal, directory, other) 2. Search for duplicate contacts and merge information 3. Update outdated contact information 4. Create missing contacts for important stakeholders 5. Organize contacts into meaningful groups 6. Generate a comprehensive contact report """, agent=contact_specialist, expected_output="Complete contact management performed with unified contact database and detailed report")
crew = Crew( agents=[contact_specialist], tasks=[comprehensive_task])
crew.kickoff()Troubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”Permission Errors
- Ensure your Google account has appropriate permissions for contacts access
- Verify that the OAuth connection includes required scopes for Google Contacts API
- Check that directory access permissions are granted for organization contacts
Resource Name Format Issues
- Ensure resource names follow the correct format (e.g., ‘people/c123456789’ for contacts)
- Verify that contact group resource names use the format ‘contactGroups/groupId’
- Check that resource names exist and are accessible
Search and Query Issues
- Ensure search queries are properly formatted and not empty
- Use appropriate readMask fields for the data you need
- Verify that search sources are correctly specified (contacts vs profiles)
Contact Creation and Updates
- Ensure required fields are provided when creating contacts
- Verify that email addresses and phone numbers are properly formatted
- Check that updatePersonFields parameter includes all fields being updated
Directory Access Issues
- Ensure you have appropriate permissions to access organization directory
- Verify that directory sources are correctly specified
- Check that your organization allows API access to directory information
Pagination and Limits
- Be mindful of page size limits (varies by endpoint)
- Use pageToken for pagination through large result sets
- Respect API rate limits and implement appropriate delays
Contact Groups and Organization
- Ensure contact group names are unique when creating new groups
- Verify that contacts exist before adding them to groups
- Check that you have permissions to modify contact groups
Getting Help
Section titled “Getting Help”Need Help?
Contact our support team for assistance with Google Contacts integration setup or troubleshooting.