Communication
Gmail
Search email, work with attachments, draft replies and send messages through Gmail.
Explore 13 capabilities ↓What you can build
- Triage a label by priority and surface threads that need a reply
- Draft and send replies that match the thread context
- Extract attachments and parse PDFs (e.g. invoices, expense reports)
- Route receipt threads to a Google Sheet and mark them processed
- Send templated notifications or reports with attachments
Access and credentials
Read, modify labels on, and send Gmail messages via a restricted OAuth scope. Reading and labeling are reversible; sending and replying are mutating.
This plugin declares OAuth access. Provider permissions and connection setup must be reviewed when a compatible release is installed.
Example action
Find unread messages
Use this call in a saved OrgSDK action after enabling the plugin and connecting a credential.
return await gmail.getMessages({
"query": "is:unread",
"maxResults": 10
});Use with OrgSDK
OrgSDK gives external AI clients persistent projects and controlled execution. Plugins add optional tools to those projects. Each run uses pinned plugin versions, and project configuration determines which credentials they can use.
Set up OrgSDK locally ↗The plugin’s toolkit
Capabilities
13 functions from this published version. Read calls retrieve or process information; write actions can change data in the connected service.
13 of 13 functions
gmail.getMessages
Read callFetch Gmail messages using Gmail search query syntax (q). Label filters must use the label name (not the label ID), e.g. label:Expense or label:"Expense Reports". Returns cleaned text body optimized for LLM processing. HTML is converted to clean text, tracking pixels and quoted chains are removed.
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
query | string | — |
maxResults | number | — |
Returns Promise<Array<{ id: string; threadId?: string; subject?: string; from?: string; date?: string; body: string; headers?: Record<string, string>; labelIds?: string[]; attachments?: Array<{ filename: string; mimeType?: string; attachmentId: string; size?: number }> }>>
gmail.getMessage
Read callFetch a single Gmail message by ID. Returns cleaned text body optimized for LLM processing. HTML is converted to clean text, tracking pixels and quoted chains are removed.
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
id | string | — |
Returns Promise<{ id: string; threadId?: string; subject?: string; from?: string; date?: string; body: string; headers?: Record<string, string>; labelIds?: string[]; attachments?: Array<{ filename: string; mimeType?: string; attachmentId: string; size?: number }> }>
gmail.listLabels
Read callList Gmail labels (id + name)
Parameters and return value
This call takes no parameters.
Returns Promise<Array<{ id?: string; name?: string }>>
Get or create a Gmail label by name; returns label object (id + name)
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
name | string | — |
Returns Promise<{ id?: string; name?: string }>
Add/remove Gmail label IDs on a message. Use removeLabelIds:['UNREAD'] to mark as read.
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
messageId | string | — |
addLabelIds | string[] | — |
removeLabelIds | string[] | — |
Returns Promise<{ success: boolean; id?: string; labelIds: string[] }>
Batch add/remove label IDs across multiple message IDs
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
messageIds | string[] | — |
addLabelIds | string[] | — |
removeLabelIds | string[] | — |
Returns Promise<{ success: boolean; count: number }>
Mark Gmail message as read (removes UNREAD label)
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
messageId | string | — |
Returns Promise<{ success: boolean; id?: string; labelIds: string[] }>
Mark Gmail message as unread (adds UNREAD label)
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
messageId | string | — |
Returns Promise<{ success: boolean; id?: string; labelIds: string[] }>
Send an email via Gmail. Supports plain-text or HTML body. When html is provided, sends a multipart/alternative message with both text/plain and text/html parts.
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
to | string | — |
subject | string | — |
body | string | — |
html | string | — |
cc | string | — |
bcc | string | — |
Returns Promise<{ success: boolean; id: string; threadId?: string }>
Send an email with file attachments via Gmail. Builds a MIME multipart/mixed message with a plain-text or HTML body and one or more base64-encoded attachments. When html is provided, the body is nested in multipart/alternative.
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
to | string | — |
subject | string | — |
body | string | — |
html | string | — |
attachments | Array<{ filename: string; mimeType: string; base64Data: string }> | — |
cc | string | — |
bcc | string | — |
Returns Promise<{ success: boolean; id: string; threadId?: string }>
Reply to a Gmail message within its thread. Fetches the original message to set threading headers (In-Reply-To, References) and replies to the original sender. Supports HTML via multipart/alternative when html parameter is provided.
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
messageId | string | — |
body | string | — |
html | string | — |
cc | string | — |
bcc | string | — |
Returns Promise<{ success: boolean; id: string; threadId?: string }>
gmail.getMessageAttachment
Read callFetch a Gmail attachment by messageId + attachmentId. Returns standard base64 bytes (dataBase64).
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
messageId | string | — |
attachmentId | string | — |
Returns Promise<{ messageId: string; attachmentId: string; size?: number; dataBase64: string }>
gmail.getThread
Read callFetch all messages in a Gmail thread by threadId, in chronological order. Unlike getMessages, this preserves quoted reply chains so the full conversation context is available. Use this before replying to understand the complete thread history.
Parameters and return value
| Parameter | Type | Details |
|---|---|---|
threadId | string | — |
Returns Promise<Array<{ id: string; subject?: string; from?: string; to?: string; date?: string; body: string; threadId?: string; labelIds?: string[] }>>
