Gmail
Siesta AI - Gmail allows secure work with a Gmail account through the official Gmail API. The integration provides reading, creating, and sending emails, which can be combined with GPT models and corporate workflows.
Quick Connection
To create, simply click on Add Connection, select Gmail, and the page will automatically redirect to Google sign-in. After signing in, the account is linked.
Available Operations
1. CreateDraft
Creates a new email draft in the Gmail inbox.
| Parameter | Type | Required | Description |
|---|---|---|---|
| body | String | Yes | Email text (plain) |
| subject | String | Yes | Email subject |
| to | String | Yes | Email address |
| attachmentsJson | String | No | Optional JSON array of attachments passed as a string. See passing an attachment through a workflow. |
Use cases: automated email generation by AI models, preparation for approval, templates/suggestions.
2. SendEmailAsync
Sends an email directly from the Gmail account.
| Parameter | Type | Required | Description |
|---|---|---|---|
| body | String | Yes | Email text |
| subject | String | Yes | Email subject |
| to | String | Yes | Recipient address |
| attachmentsJson | String | No | Optional JSON array of attachments passed as a string. See passing an attachment through a workflow. |
Use cases: automatic notifications, sales/marketing sequences, follow-ups, AI-generated reports.
3. ListInboxAsync
Retrieves a list of the most recent messages in the inbox.
| Parameter | Type | Required | Description |
|---|---|---|---|
| includeSpamTrash | Bool | No | Include spam and trash |
| maxResults | Int | No | Number of returned messages |
Use cases: AI agents for email, inbox summarization, categorization and routing, detection of priority messages.
4. GetMessageAsync
Retrieves the complete content of a specific message including metadata.
| Parameter | Type | Required | Description |
|---|---|---|---|
| messageId | String | Yes | Message ID in Gmail API |
Use cases: content analysis using GPT, data extraction (orders, contacts, SLAs), thread reconstruction, context for automated replies.
5. ListAttachmentsAsync
Lists the attachments of a message. Use the returned attachment identifier when downloading a file; a file name alone is not an attachment identifier.
| Parameter | Type | Required | Description |
|---|---|---|---|
| messageId | String | Yes | Gmail message ID containing the attachments |
6. DownloadAttachmentAsync
Downloads one attachment. Choose whether you need readable text, the original file, or both.
| Parameter | Type | Required | Description |
|---|---|---|---|
| messageId | String | Yes | Gmail message ID containing the attachment |
| attachmentId | String | Yes | Attachment identifier returned by ListAttachmentsAsync |
| mode | String | No | text (default), file, or both |
| Mode | Returned data | FileReader text extraction | Attachment limit |
|---|---|---|---|
text (default) | Extracted text in Content | Yes | 25 MiB |
file | Original file in FileBase64 | No | 2 MiB |
both | Original file and extracted text, when available | Yes | 2 MiB |
file returns the original attachment bytes encoded as Base64. Decoding them gives you the unchanged PDF, image, or ZIP, not text extracted from a PDF. Existing workflows that omit mode continue to use text.
The result still includes the file name, MIME type, and size. In file modes, ExtractionStatus describes the text extraction outcome:
| Status | Meaning |
|---|---|
notRequested | Text extraction was not requested (file mode). |
succeeded | Text extraction succeeded. |
unavailable | Extracted text is unavailable. |
failed | Text extraction failed. |
In both mode, an unsuccessful text extraction does not discard the original file. The response must still fit the limits described below.
Pass an Attachment Through a Workflow
For example, download an invoice from one message and attach the original PDF to a new draft:
- Call
ListAttachmentsAsyncwith the sourcemessageIdand select the attachment. - Call
DownloadAttachmentAsyncwith thatmessageId, the returnedattachmentId, andmodeset tofile. - Read
FileName,MimeType, andFileBase64from the download'sStructuredOutput. - Map those fields to one item in the JSON array passed as the optional
attachmentsJsonstring toCreateDraftorSendEmailAsync.
| Download output field | Field in an attachmentsJson item |
|---|---|
FileName | fileName (required) |
MimeType | mimeType (optional) |
FileBase64 | fileBase64 (required) |
The following is a data format example, not workflow editor syntax. It represents a small text file containing Hello. For a real attachment, use the actual downloaded values and serialize the array as the attachmentsJson string.
[
{
"fileName": "hello.txt",
"mimeType": "text/plain",
"fileBase64": "SGVsbG8="
}
]
Base64 is included only in StructuredOutput, not in LlmText. A workflow can map it directly without asking an LLM to copy or decode it. This describes the data contract; the workflow must explicitly map the output into the next operation's input. Creating a draft does not send it.
Attachment Limits and Storage
- Per attachment:
fileandbothaccept up to 2 MiB;textretains its 25 MiB limit. - Download response: file modes also enforce an approximately 3 MiB budget for the response's text fields. In
both, a smaller file can still exceed this budget when it produces a large amount of extracted text. - Combined sending: an Iterator processes attachments individually but does not remove the limit on a later combined request. Two 2 MiB attachments produce more than 5 MiB of Base64 alone. This exceeds the default 4 MiB gRPC receive limit unless the receiving service is configured otherwise. These download modes do not increase that setting. This is a transport limit, separate from Gmail's own limits. See Microsoft's gRPC configuration documentation.
- API destinations: direct forwarding applies only when the destination API accepts Base64 in JSON. These modes do not add
multipart/form-data, binary HTTP upload, or general file input support. - File storage: the entire file travels as a Base64 JSON string. These modes do not add Azure Blob Storage, a download link, or a reusable
fileRef. - Workflow history: Base64 may be saved as part of the workflow's output history. No Azure storage does not mean that the attachment is never stored.
Capabilities Enabled by Gmail Integration
- AI-enhanced drafting: generating email drafts from context and corporate data.
- AI inbox agent: automatic replies, labeling, prioritization, summarization of threads.
- Automation workflows: follow-ups, escalations, onboarding sequences, client communication.
- Data extraction: structured data from emails, conversion to ticketing/CRM/ERP, links to internal systems.
Requirements for Integration
- Google Cloud Project: Gmail API enabled, OAuth 2.0 Client ID created, authorized redirect URL for Siesta AI.
- OAuth 2.0 Authorization: user grants access; typical scopes:
- Secure token storage: tokens are encrypted, with automatic refresh token rotation.
- Google API quotas & rate limits: minimize GetMessageAsync calls, batch inbox operations, cache metadata.
- Governance & controls: validation of emails before sending, whitelisting addresses/domains, audit logs, approval workflows.
Security Considerations
- Emails and metadata are not stored without explicit purpose.
- Access tokens are encrypted and regularly refreshed.
- Each operation is auditable; Siesta AI does not send emails without approval or organizational policy.
How to Connect (OAuth)
-
Add Connection -> select
Gmail(same selection for Gmail/Google Calendar/Google Search). -
Sign in with Google (OAuth login).
-
Confirm integration name (internal name in Siesta AI).
-
Consent to permissions (scopes according to Gmail integration).
Summary
The Gmail integration provides Siesta AI with a reliable and secure way to automate corporate communication. The combination of the Gmail API and AI orchestration speeds up email handling, enables analysis of incoming information, and automates routine tasks.
If authorization expires or Gmail reports a missing scope, have the connection owner reconnect the account and then test a read operation before any confirmed send. Use the shared connection health and reauthorization checklist to distinguish credential, scope, network, and function errors.
Technical Notes
- Implementation: The connection exposes Gmail mailbox actions.
- Authentication/scopes: uses a Google OAuth token for the connected Gmail account. The token must allow the enabled Gmail read, send, label modification, and draft operations.
- Functions: send email, list messages using Gmail search syntax, get message details, list and download attachments, modify labels, and create drafts with optional attachments.
- Write behavior: sending email, creating drafts, and changing labels are mailbox-changing operations and should be protected with confirmation for customer or shared inboxes.