Skip to main content

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.

ParameterTypeRequiredDescription
bodyStringYesEmail text (plain)
subjectStringYesEmail subject
toStringYesEmail address
attachmentsJsonStringNoOptional 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.

ParameterTypeRequiredDescription
bodyStringYesEmail text
subjectStringYesEmail subject
toStringYesRecipient address
attachmentsJsonStringNoOptional 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.

ParameterTypeRequiredDescription
includeSpamTrashBoolNoInclude spam and trash
maxResultsIntNoNumber 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.

ParameterTypeRequiredDescription
messageIdStringYesMessage 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.

ParameterTypeRequiredDescription
messageIdStringYesGmail message ID containing the attachments

6. DownloadAttachmentAsync​

Downloads one attachment. Choose whether you need readable text, the original file, or both.

ParameterTypeRequiredDescription
messageIdStringYesGmail message ID containing the attachment
attachmentIdStringYesAttachment identifier returned by ListAttachmentsAsync
modeStringNotext (default), file, or both
ModeReturned dataFileReader text extractionAttachment limit
text (default)Extracted text in ContentYes25 MiB
fileOriginal file in FileBase64No2 MiB
bothOriginal file and extracted text, when availableYes2 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:

StatusMeaning
notRequestedText extraction was not requested (file mode).
succeededText extraction succeeded.
unavailableExtracted text is unavailable.
failedText 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:

  1. Call ListAttachmentsAsync with the source messageId and select the attachment.
  2. Call DownloadAttachmentAsync with that messageId, the returned attachmentId, and mode set to file.
  3. Read FileName, MimeType, and FileBase64 from the download's StructuredOutput.
  4. Map those fields to one item in the JSON array passed as the optional attachmentsJson string to CreateDraft or SendEmailAsync.
Download output fieldField in an attachmentsJson item
FileNamefileName (required)
MimeTypemimeType (optional)
FileBase64fileBase64 (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: file and both accept up to 2 MiB; text retains 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​

  1. Google Cloud Project: Gmail API enabled, OAuth 2.0 Client ID created, authorized redirect URL for Siesta AI.
  2. OAuth 2.0 Authorization: user grants access; typical scopes:
  3. Secure token storage: tokens are encrypted, with automatic refresh token rotation.
  4. Google API quotas & rate limits: minimize GetMessageAsync calls, batch inbox operations, cache metadata.
  5. 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)​

  1. Add Connection -> select Gmail (same selection for Gmail/Google Calendar/Google Search).

  2. Sign in with Google (OAuth login).

  3. Confirm integration name (internal name in Siesta AI).

  4. 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.