Gmail API: what you can do and how to use it with AI agents
The Gmail API gives programmatic access to Gmail and Google Workspace mailboxes: messages, threads, labels and drafts. Companies use it to automate triage, replies and logging e-mails in other systems. Access is by OAuth 2.0 with a Google Cloud project.
What the Gmail API offers
Messages and threads
Reading, searching with the same syntax as Gmail, sending and moving e-mails and threads.
Drafts
Creating and editing drafts that can be reviewed before sending.
Labels
Creating and applying labels to organize the inbox.
Attachments
Downloading and sending attached files.
Push notifications
Alerts about mailbox changes through Google Cloud Pub/Sub.
Settings
Filters, auto-replies, forwarding and signatures.
How to access the Gmail API
- With your company’s credentialsOAuth 2.0 with a Google Cloud project and Gmail scopes; on Workspace accounts, the administrator can authorize a service account with domain-wide delegation.
- Broad Gmail scopes are classified as restricted by Google and may require app verification.
- There are usage quotas per user and per project.
- E-mails contain personal and confidential data: limit which mailboxes the agent accesses.
Official documentation: developers.google.com/gmail/api
What an iTeam agent does with the Gmail API
Sales inbox triage
The agent reads e-mails sent to the contact address, sorts them by subject, creates the lead in the CRM and prepares a draft reply for the salesperson to review.
Supplier invoices and payment slips
Invoice and payment-slip attachments are identified, saved in the right folder and entered as a payable for checking.
Follow-up that never slips
The agent tracks proposals that were sent and, with no reply after the agreed time, suggests a follow-up in the company's tone.
Inbox summary for executives
Executives get a daily summary of the e-mails that need a decision, separated from the rest.
From the credential to the agent at work, with approval
Create the Google Cloud project
Enable the Gmail API, set up the consent screen and choose the minimum scopes, such as read and drafts.
Authorize the mailboxes in iTeam
Each mailbox is authorized by OAuth or by administrator delegation; the token stays in the vault and you define what each agent can do.
Start with drafts
At first the agent only creates drafts and labels; direct sending is enabled later for low-risk messages.
Ready-made AI teams that use Gmail
Outbound prospecting team
It finds the accounts that fit, reads what they are doing right now and writes a first message that sounds like it came from a person.
Accounts payable team
Invoices arrive by e-mail and in shared folders. The team reads them, checks them and lines them up for your approval before the due date.
Collections team
Before and after each due date, customers get a clear reminder with a payment link. Disputes and promises to pay go to your team.
Bookkeeping team
Transactions are categorized as they come in, receipts are matched, and the month-end close starts with a short list of questions.
Recruiting and screening team
Each application is read against the criteria you set, with a written reason. Recruiters decide; the team books the interviews.
Procurement and quotes team
Requests go out to suppliers, quotes come back into one table, and the approver sees price, terms and past orders before saying yes.
Questions about the Gmail API
Is the Gmail API free?
Yes, in general. Using the API is not charged within Google's quotas; the cost is the Gmail or Workspace account itself.
Do I need to write code to use the Gmail API with iTeam?
No. iTeam already connects to Gmail and the deployment team helps with the Google Cloud project and the authorizations.
Does the agent send e-mail on my behalf without my seeing it?
Only if you allow it. By default the agent prepares drafts and sends after your approval.