Google Mail List

Google Mail List

Certified

List Gmail messages

Lists message IDs with optional Gmail search, label filters, and spam/trash inclusion. Fetch type controls output: FETCH (default) returns all, FETCH_ONE first only, STORE writes to kestra:// file, NONE outputs nothing.

yaml
type: io.kestra.plugin.googleworkspace.mail.List

List all messages in inbox

yaml
id: list_messages
namespace: company.team

tasks:
  - id: list_messages
    type: io.kestra.plugin.googleworkspace.mail.List
    clientId: "{{ secret('GMAIL_CLIENT_ID') }}"
    clientSecret: "{{ secret('GMAIL_CLIENT_SECRET') }}"
    refreshToken: "{{ secret('GMAIL_REFRESH_TOKEN') }}"
    maxResults: 10

List unread messages

yaml
id: list_unread_messages
namespace: company.team

tasks:
  - id: list_unread
    type: io.kestra.plugin.googleworkspace.mail.List
    clientId: "{{ secret('GMAIL_CLIENT_ID') }}"
    clientSecret: "{{ secret('GMAIL_CLIENT_SECRET') }}"
    refreshToken: "{{ secret('GMAIL_REFRESH_TOKEN') }}"
    query: is:unread
    labelIds:
      - INBOX
    maxResults: 50
    fetchType: STORE

Get first message only

yaml
id: get_first_message
namespace: company.team

tasks:
  - id: get_first
    type: io.kestra.plugin.googleworkspace.mail.List
    clientId: "{{ secret('GMAIL_CLIENT_ID') }}"
    clientSecret: "{{ secret('GMAIL_CLIENT_SECRET') }}"
    refreshToken: "{{ secret('GMAIL_REFRESH_TOKEN') }}"
    fetchType: FETCH_ONE
    maxResults: 1
Installation

Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:

kestractl plugins get io.kestra.plugin:plugin-googleworkspace --compatible-for $KESTRA_VERSION

For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.

For Kestra CLI, replace LATEST with a specific version or version range to pin the plugin version.

Properties

OAuth client ID

Google OAuth 2.0 client ID for the Gmail project

OAuth client secret

Google OAuth 2.0 client secret

OAuth refresh token

Refresh token obtained via OAuth consent; used to mint access tokens

OAuth access token

Optional access token; if absent, one is fetched from the refresh token

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
DefaultFETCH
Possible Values
STOREFETCHFETCH_ONENONE

Fetch strategy

FETCH (all), FETCH_ONE (first only), STORE (write all to file), NONE (no output). Default FETCH.

Defaultfalse

Include spam and trash

Whether to include SPAM and TRASH messages

SubTypestring

Label filters

Label IDs to restrict search (INBOX, SENT, UNREAD, etc.)

Default100

Maximum results

Max messages to return (default 100, capped at 500)

Gmail search query

Gmail search syntax (e.g., is: unread, from: sender@example.com, subject: important)

Default120

The read timeout for the request (in seconds)

SubTypestring
Default["https://www.googleapis.com/auth/gmail.modify","https://www.googleapis.com/auth/gmail.readonly","https://www.googleapis.com/auth/gmail.send"]

The OAuth scopes to use

List of OAuth 2.0 scopes required for the operation

Single message (when fetchType is FETCH_ONE)

Definitions
attachmentsarray

List of attachments in the message

attachmentIdstring

The attachment ID

datastring

The attachment data as a base64url encoded string

filenamestring

The filename of the attachment

mimeTypestring

The MIME type of the attachment file

sizeinteger

The size of the attachment in bytes

bccarray
SubTypestring

The BCC recipient email addresses

ccarray
SubTypestring

The CC recipient email addresses

fromstring

The sender email address

headersobject

The parsed headers of the message

historyIdstring

The ID of the last history record that modified this message

idstring

The immutable ID of the message

internalDatestring
Formatdate-time

The internal message creation timestamp

labelIdsarray
SubTypestring

List of IDs of labels applied to this message

rawstring

The entire email message in an RFC 2822 formatted and base64url encoded string

sizeEstimateinteger

Estimated size in bytes of the message

snippetstring

A short part of the message text

subjectstring

The message subject

textHtmlstring

The HTML body of the message

textPlainstring

The plain text body of the message

threadIdstring

The ID of the thread the message belongs to

toarray
SubTypestring

The recipient email addresses

List of messages (when fetchType is FETCH)

Definitions
attachmentsarray

List of attachments in the message

attachmentIdstring

The attachment ID

datastring

The attachment data as a base64url encoded string

filenamestring

The filename of the attachment

mimeTypestring

The MIME type of the attachment file

sizeinteger

The size of the attachment in bytes

bccarray
SubTypestring

The BCC recipient email addresses

ccarray
SubTypestring

The CC recipient email addresses

fromstring

The sender email address

headersobject

The parsed headers of the message

historyIdstring

The ID of the last history record that modified this message

idstring

The immutable ID of the message

internalDatestring
Formatdate-time

The internal message creation timestamp

labelIdsarray
SubTypestring

List of IDs of labels applied to this message

rawstring

The entire email message in an RFC 2822 formatted and base64url encoded string

sizeEstimateinteger

Estimated size in bytes of the message

snippetstring

A short part of the message text

subjectstring

The message subject

textHtmlstring

The HTML body of the message

textPlainstring

The plain text body of the message

threadIdstring

The ID of the thread the message belongs to

toarray
SubTypestring

The recipient email addresses

Token for retrieving next page of results

Total estimated number of results

Formaturi

URI of the stored messages file (when fetchType is STORE)