Get Emails from Gmail.

Parameters:
GMailGet is an Input action that reads messages from a Gmail or Google Workspace mailbox via the Gmail API. It produces one row per message (optionally one row per part, depending on your build), with parsed headers, addresses, subject, timestamps, and body (text/HTML). You can limit retrieval to unseen mail, filter by Gmail’s search syntax, and decide whether to leave messages unchanged, mark them as read, or delete them after ingestion. Attachments can be downloaded to a local folder and referenced in the output.
Key capabilities:
newer_than:7d from:noreply@yourco.com.gmail.modify scope).A Google Cloud project with Gmail API enabled.
OAuth consent screen configured (External with your account added as a Test user, or Internal for Workspace).
OAuth client (Web application) with this Authorized redirect URI:
https://developers.google.com/oauthplayground
A Refresh Token minted with the scopes you need:
https://www.googleapis.com/auth/gmail.readonlyhttps://www.googleapis.com/auth/gmail.modifyNetwork egress to oauth2.googleapis.com and Gmail endpoints.
A Gmail/Workspace mailbox with necessary permission and quota.
Enable Gmail API
Google Cloud Console → APIs & Services → Library → search “Gmail API” → Enable.
Configure OAuth consent screen
Set the publishing status and add yourself to Test users (if External).
Create OAuth client
APIs & Services → Credentials → Create credentials → OAuth client ID
https://developers.google.com/oauthplaygroundMint a refresh token in OAuth 2.0 Playground
Open the Playground → gear icon
offline (checked)consent (checked)Step 1: Input scope(s). Recommended single line:
https://www.googleapis.com/auth/gmail.modify
(You can also add gmail.readonly instead, but “mark as read”/“delete” won’t work.)
Authorize APIs → Allow → Exchange authorization code for tokens.
Copy the Refresh token (a long string starting with 1//).
Store securely in atrnatv
Pipeline Secrets (recommended):
gmail_client_id = your client idgmail_client_secret = your client secretgmail_refresh_token = the refresh token (1//…)Use these secrets in GMailGet (or paste values directly with Easy Mode = OFF).
Security: Never commit tokens or client secrets to source control. Rotate the client secret periodically; mint a new refresh token afterward.
No upstream dataset is required. GMailGet pulls directly from Gmail using the parameters you set:
newer_than:1d, from:alerts@yourco.com, subject:"invoice").gmail.modify.Get unseen only = ON, plus a Custom query like newer_than:1d.The action emits one row per message with typical columns such as:
id, threadId, historyId, labelIds[], isUnreadfrom, to, cc, bccsubject, snippet, body_text, body_htmlreceivedAt (UTC), internalDateheaders.MessageId, headers.InReplyTo, headers.Referencesattachments.count, attachments.names[], attachments.paths[]Column names may vary slightly by build; verify on the Data tab after a test run.
Create credentials & token (see Prerequisites). Use scope https://www.googleapis.com/auth/gmail.modify to enable mark-as-read/delete.
Configure GMailGet (first run)
newer_than:1dRun and inspect the Data output (row count, subjects, timestamps).
Enable attachments (optional)
./out/GMailGet/attachments/attachments.paths[] is populated.Enable state changes (optional)
gmail.modify).| Symptom / Log | Likely Cause | Resolution |
|---|---|---|
Error 400: redirect_uri_mismatch during consent |
OAuth client not Web, or redirect URI not added | Create Web application client and add https://developers.google.com/oauthplayground to Authorized redirect URIs. |
invalid_client / unauthorized_client |
Wrong client id/secret or project | Check you’re using the same project where Gmail API is enabled; re-copy Client ID/Secret. |
invalid_grant at token endpoint |
Stale/revoked refresh token | Re-authorize in Playground with Use your own credentials, offline, force consent; paste the new refresh token. Remove old app at myaccount.google.com/permissions if needed. |
insufficientPermissions |
Token missing required scope | Re-mint token with https://www.googleapis.com/auth/gmail.modify (or gmail.readonly if you never change state). |
| No rows or huge runtime | Too broad selection | Start with Inbox only, Get unseen only = ON, and a query like newer_than:1d. |
| Attachments not saved | Save toggles off / folder missing | Turn on Save Standard Attachments and set a writable Attachment folder; enable Overwrite for idempotency. |
| Garbled text in body | Encoding/part selection | Prefer body_text for plain text pipelines; if HTML needed, parse body_html and strip markup downstream. |
from: and subject: filters, mark as read after processing.subject:invoice, save PDF attachments for OCR and posting.newer_than:31d from:vendor@domain.