Get a Gmail message
Retrieve a specific Gmail message by ID with full content and metadata
type: "io.kestra.plugin.googleworkspace.mail.Get"Examples
Get a message by ID
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
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
clientId *Requiredstring
OAuth 2.0 Client ID
The OAuth 2.0 client ID from Google Cloud Console
clientSecret *Requiredstring
OAuth 2.0 Client Secret
The OAuth 2.0 client secret from Google Cloud Console
messageId *Requiredstring
Message ID
The ID of the message to retrieve
refreshToken *Requiredstring
OAuth 2.0 Refresh Token
The OAuth 2.0 refresh token obtained through the authorization flow
accessToken string
OAuth 2.0 Access Token
The OAuth 2.0 access token (optional, will be generated from refresh token if not provided)
format string
fullMessage format
The format to return the message payload in (options: minimal, full, raw, metadata)
readTimeout integerstring
120The read timeout for the request (in seconds)
scopes array
["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
Outputs
message Message
The retrieved message
Definitions
Gmail message representation
bcc array
The BCC recipient email addresses
cc array
The CC recipient email addresses
from string
The sender email address
headers object
The parsed headers of the message
historyId string
The ID of the last history record that modified this message
id string
The immutable ID of the message
internalDate string
date-timeThe internal message creation timestamp
labelIds array
List of IDs of labels applied to this message
raw string
The entire email message in an RFC 2822 formatted and base64url encoded string
sizeEstimate integer
Estimated size in bytes of the message
snippet string
A short part of the message text
subject string
The message subject
textHtml string
The HTML body of the message
textPlain string
The plain text body of the message
threadId string
The ID of the thread the message belongs to
to array
The recipient email addresses
Gmail message attachment
attachmentId string
The attachment ID
data string
The attachment data as a base64url encoded string
filename string
The filename of the attachment
mimeType string
The MIME type of the attachment file
size integer
The size of the attachment in bytes