StyloDocs
Workflow blocks

Gmail

Send, read, search, organize, and label Gmail messages and drafts

View as Markdown

gmail — Send, read, search, organize, and label Gmail messages and drafts.

Where it appears

The Gmail block lives in the Integrations group of the Workflow Builder. Connect the Gmail integration before adding it.

Fields

FieldTypeRequiredDefaultDescription
resourceselectYesmessageWhich Gmail resource to work with. Options: message, draft.
operationselectYesWhich action to perform on the selected resource.
totext (supports references)YesRecipient email address. Use literal text or <StepName.field> to reference an address from a previous step.
cctext (supports references)NoOptional CC recipient address(es). Accepts literal text or <StepName.field>.
bcctext (supports references)NoOptional BCC recipient address(es), hidden from other recipients. Accepts literal text or <StepName.field>.
subjecttext (supports references)YesSubject line of the email. Use literal text or <StepName.field> to reference a value from a previous step.
bodytext (multi-line, supports references)YesBody content of the email, interpreted according to the Content Type field. Use literal text or <StepName.field> to reference upstream content.
contentTypeselectNotextHow the body is sent: Plain Text or HTML. Choose HTML to send formatted markup. Options: text, html.
messageIdtext (supports references)YesGmail message ID to act on. Use a literal ID or <StepName.field> to reference an ID from a previous step (e.g. a search result).
querytext (supports references)YesGmail search query using Gmail's search operators (e.g. in:inbox from:support@example.com). Use literal text or <StepName.field>.
maxResultsnumberNo25Maximum number of matching messages to return. Defaults to 25.
addLabelIdstext (supports references)NoComma-separated Gmail label IDs to add to the message (e.g. Label_123,IMPORTANT). Accepts literal text or <StepName.field>.
removeLabelIdstext (supports references)NoComma-separated Gmail label IDs to remove from the message (e.g. INBOX to move it out of the inbox). Accepts literal text or <StepName.field>.
labelIdstext (supports references)YesComma-separated Gmail label IDs to apply to or remove from the message (e.g. Label_123,IMPORTANT). Accepts literal text or <StepName.field>.

Inputs and outputs

Inputs are the configurable fields above. The block produces these outputs:

Outputs

Reference an output downstream with <Gmail.field>.

NameTypeDescription
successbooleanOperation succeeded
messageIdstringSent message ID
threadIdstringThread ID
errorstringError message if failed
messagejsonEmail message object
messagesarrayArray of message IDs
resultSizeEstimatenumberEstimated result count
modifiedbooleanMessage was modified
deletedbooleanMessage was deleted
draftIdstringDraft ID

Example

A minimal configuration for this block:

{
  "type": "gmail",
  "config": {
    "resource": "message",
    "operation": "...",
    "to": "<PreviousStep.field>",
    "subject": "<PreviousStep.field>",
    "body": "<PreviousStep.field>",
    "contentType": "text",
    "messageId": "<PreviousStep.field>",
    "query": "<PreviousStep.field>",
    "maxResults": 25,
    "labelIds": "<PreviousStep.field>"
  }
}

Limits and failure modes

  • Requires a connected Gmail integration. Calls fail if that integration is disconnected or its authorization has expired.
  • Required fields (resource, operation, to, subject, body, messageId, query, labelIds) must be set, or the block fails validation before it runs.
  • On failure the error output is populated; downstream blocks that reference other outputs may not receive values.

On this page