Gmail
Send email as yourself, answer emails in their thread, find emails with Gmail search, read them (text, HTML and attachments) and organise them with labels. Works with personal Gmail and Google Workspace accounts.
1. Connect
- In Blokkio, go to Apps and open Gmail.
- Click Sign in under Sign in with Google, choose your Google account and allow access.
- Test connection calls
GET /users/me/profile.
Blokkio asks for one scope, https://www.googleapis.com/auth/gmail.modify (read, send, label and trash email; it can't
delete email permanently), with offline access so the connection keeps working after you sign out.
If Sign in with Google isn't offered, or your organisation requires its own OAuth client, use Bring your own OAuth app instead:
- In the Google Cloud console, create a project and enable the Gmail API (APIs & Services → Library).
- Set up the OAuth consent screen: add yourself as a test user and add the
gmail.modifyscope. - Credentials → Create credentials → OAuth client ID, type Web application. Under Authorized redirect URIs
add Blokkio's redirect URI:
https://api.blokkio.com/api/connections/oauth2/callback. - Paste the Client ID and Client secret when you connect.
:::note Testing apps expire after 7 days
While your Google OAuth app is in Testing, Google ends the sign-in after 7 days and you need to re-authenticate the
connection. gmail.modify is a restricted scope: publishing the app for other users needs Google's verification.
:::
Actions
| Action | What it does |
|---|---|
| Send email | To, Cc, Bcc (addresses separated by commas, Ada <ada@example.com> works), Subject, Plain text and/or HTML, Attachments (files from other blocks, up to 25 MB), optional From (one of your Send mail as addresses) and Reply-to. |
| Reply to email | Give the Email ID and your text. Blokkio reads the original first and answers the sender (or their Reply-To address) in the same thread, with Re: and the threading headers set, so it shows as a reply everywhere. You can override To and Subject. |
| Create draft | Saves an email in Drafts. |
| Search emails | Gmail search syntax, as in the search box: from:billing@example.com is:unread newer_than:7d. Returns items with id and threadId; use Get email for the content. |
| Get email | Outputs subject, from, fromName, fromAddress, to, cc, date, text, html, labelIds, snippet and attachments (each with filename, contentType, size and a file other blocks can use). |
| Add or remove labels | Label IDs to add and/or remove. System labels: INBOX, UNREAD, STARRED, IMPORTANT, SPAM, TRASH. Remove UNREAD to mark as read, remove INBOX to archive. |
| List labels | Your labels and their IDs (Label_123…). |
| Create label | A new label; use / for nesting (Clients/Acme). |
| Move email to trash | Gmail deletes it after 30 days. |
Example: reply to every new email from a customer.
New email (search: from:@customer.com) → Reply to email (Email ID: {{ $trigger.id }}, Plain text: Thanks, we're on it!)
Triggers
New email starts a run for each new email matching a Gmail search (default in:inbox), checked at the trigger's
polling interval. Each run gets the email's id and threadId: add Get email to read it.
Troubleshooting
| Message | What to do |
|---|---|
HTTP 403 … insufficient authentication scopes | The connection was made with other scopes: re-authenticate it. |
HTTP 400 … Invalid To header | Check the addresses; separate several with commas. |
HTTP 404 on Reply / Get | The Email ID is wrong or the email was deleted. |
invalid_grant when refreshing | You revoked access, or (testing apps) 7 days passed: re-authenticate. |