Google Workspace Get

Google Workspace Get

Certified

Fetch a Gmail message by ID

Retrieves one message with chosen format (minimal, full, raw, metadata). Defaults to full; requires OAuth Gmail scopes.

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

Get a message by ID

yaml
id: get_gmail_message
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: 1

  - id: get_message
    type: io.kestra.plugin.googleworkspace.mail.Get
    clientId: "{{ secret('GMAIL_CLIENT_ID') }}"
    clientSecret: "{{ secret('GMAIL_CLIENT_SECRET') }}"
    refreshToken: "{{ secret('GMAIL_REFRESH_TOKEN') }}"
    messageId: "{{ outputs.list_messages.messages[0].id }}"

Get message with specific format

yaml
id: get_message_metadata
namespace: company.team

tasks:
  - id: get_full_message
    type: io.kestra.plugin.googleworkspace.mail.Get
    clientId: "{{ secret('GMAIL_CLIENT_ID') }}"
    clientSecret: "{{ secret('GMAIL_CLIENT_SECRET') }}"
    refreshToken: "{{ secret('GMAIL_REFRESH_TOKEN') }}"
    messageId: "1a2b3c4d5e6f7890"
    format: full
Properties

OAuth client ID

Google OAuth 2.0 client ID for the Gmail project

OAuth client secret

Google OAuth 2.0 client secret

Message ID

Gmail message ID to fetch

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

Defaultfull

Message format

minimal, full, raw, or metadata; defaults to full

Reference (ref) of the pluginDefaults to apply to this task.

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

Retrieved message

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