Gmail
Send, reply, search, and read emails in Gmail. Create drafts, request approvals, and manage your inbox.
On this page
Connect
Auth type: OAuth (oauth2). Click Connect and approve access on the provider's page. Appbricx runs the OAuth flow (signed single-use state, PKCE where the provider supports it), stores the tokens encrypted and refreshes them before they expire.
Scopes requested: https://www.googleapis.com/auth/gmail.sendhttps://www.googleapis.com/auth/gmail.readonlyhttps://www.googleapis.com/auth/gmail.compose
OAuth needs an OAuth app: the platform's when the operator configured one, or your own (admin panel, Integrations, Configure). You can also bring your own credentials.
- In the editor: Backend panel, Integrations tab, then Connect. This connects it for the project.
- For every project in a workspace: Workspace settings, Integrations.
- Owners and admins choose which integrations members may connect in the admin panel (Integrations tab), and can attach their own OAuth app there.
Call it from a workflow
Pass the action name and its input. The call resolves with { success, output, error? }; a missing connection resolves with success false and the reason. See ctx.integrations.invoke and ctx.integrations.call.
// .workflow.js (native ctx)
export async function run(ctx) {
const res = await ctx.integrations.invoke("gmail", "create_draft_reply", {
"message_id": "<message_id>",
"reply_type": "reply",
"body_type": "plain_text",
"include_original_message": true
});
if (!res.success) throw new Error(res.error);
ctx.log.info("Gmail answered", { output: res.output });
}// defineWorkflow module (@app/sdk ctx)
import { defineWorkflow } from "@app/sdk";
export default defineWorkflow({
id: "gmail-create-draft-reply",
name: "Gmail: Create Draft Reply",
description: "Calls Gmail when a row is created.",
trigger: { type: "entity_event", entity: "tickets", event: "created" },
async run(ctx, event) {
const res = await ctx.integrations.call("gmail", {
"action": "create_draft_reply",
"message_id": "<message_id>",
"reply_type": "reply",
"body_type": "plain_text",
"include_original_message": true
}) as { success: boolean; error?: string };
if (!res.success) throw new Error(res.error);
},
});curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/gmail/create_draft_reply" \
-H "Authorization: Bearer $APP_KEY" \
-H "content-type: application/json" \
-d '{"props":{"message_id":"<message_id>","reply_type":"reply","body_type":"plain_text","include_original_message":true}}'Actions
create_draft_replyin catalog
Create Draft Reply. Creates a draft reply to an existing email.
| Input | Type | Description |
|---|---|---|
message_idrequired | id (picked from your account) | Select a message from the list or enter a message ID manually. |
reply_typerequired | one of "reply" | "reply_all" | Choose whether to reply to sender only or to all recipients |
body_typerequired | one of "plain_text" | "html" | Body Type |
bodyoptional | long text | Your draft reply message content |
include_original_messagerequired | boolean | Include the original message content in the draft reply |
sender_nameoptional | text | Optional sender name to display |
attachmentoptional | file | Optional file to attach to your draft reply |
attachment_nameoptional | text | Custom name for the attachment |
custom_api_callin catalog
Custom API Call. Make a custom API call to a specific endpoint
| Input | Type | Description |
|---|---|---|
urlrequired | object (depends on other props) | url |
methodrequired | one of "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD" | Method |
headersrequired | object | Authorization headers are injected automatically from your connection. |
queryParamsrequired | object | Query Parameters |
body_typeoptional | one of "none" | "json" | "form_data" | "raw" | Body Type |
bodyoptional | object (depends on other props) | Body |
response_is_binaryoptional | boolean | Enable for files like PDFs, images, etc. |
failsafeoptional | boolean | No Error on Failure |
timeoutoptional | number | Timeout (in seconds) |
followRedirectsoptional | boolean | Follow redirects |
gmail_get_mailin catalog
Get Email. Get an email via Id.
| Input | Type | Description |
|---|---|---|
message_idrequired | text | The messageId of the mail to read. |
gmail_search_mailin catalog
Find Email. Find emails using advanced search criteria. At least one search filter (from, to, subject, label, category, date, content, or attachment) is required.
| Input | Type | Description |
|---|---|---|
fromoptional | text | Optional filteration, leave empty to filter based on the email sender |
tooptional | text | Optional filteration, leave empty to filter based on the email recipient |
subjectoptional | text | The email subject |
contentoptional | text | Search for specific text within email body |
has_attachmentoptional | boolean | Only find emails with attachments |
attachment_nameoptional | text | Search for emails with specific attachment filename |
labeloptional | id (picked from your account) | Optional filteration, leave unselected to filter based on the email label |
categoryoptional | one of "primary" | "social" | "promotions" | "updates" | "forums" | "reservations" | "purchases" | Optional filteration, leave unselected to filter based on the email category |
after_dateoptional | date-time (ISO) | Find emails sent after this date |
before_dateoptional | date-time (ISO) | Find emails sent before this date |
include_spam_trashoptional | boolean | Include emails from Spam and Trash folders in search results |
max_resultsoptional | number | Maximum number of emails to return (1-500) |
reply_to_emailin catalog
Reply to Email. Reply to an existing email.
| Input | Type | Description |
|---|---|---|
message_idrequired | id (picked from your account) | Select a message from the list or enter a message ID manually. |
reply_typerequired | one of "reply" | "reply_all" | Choose whether to reply to sender only or to all recipients |
body_typerequired | one of "plain_text" | "html" | Body Type |
bodyrequired | long text | Your reply message content |
sender_nameoptional | text | Optional sender name to display |
attachmentoptional | file | Optional file to attach to your reply |
attachment_nameoptional | text | Custom name for the attachment |
request_approval_in_mailin catalog
Request Approval in Email. Send approval request email and then wait until the email is approved or disapproved
| Input | Type | Description |
|---|---|---|
receiverrequired | text | The email address of the recipient who will receive the approval request. |
ccoptional | array | The email addresses of the recipients who will receive a carbon copy of the approval request. |
bccoptional | array | The email addresses of the recipients who will receive a blind carbon copy of the approval request. |
subjectrequired | text | The subject of the approval request email. |
bodyrequired | text | Body for the email you want to send |
reply_tooptional | array | Email address to set as the "Reply-To" header |
sender_nameoptional | text | Sender Name |
fromoptional | text | The address must be listed in your GMail account's settings |
in_reply_tooptional | text | Reply to this Message-ID |
send_emailin catalog
Send Email. Send an email through a Gmail account
| Input | Type | Description |
|---|---|---|
receiverrequired | array | Receiver Email (To) |
ccoptional | array | CC Email |
bccoptional | array | BCC Email |
subjectrequired | text | Subject |
body_typerequired | one of "plain_text" | "html" | Body Type |
bodyrequired | text | Body for the email you want to send |
reply_tooptional | array | Email address to set as the "Reply-To" header |
sender_nameoptional | text | Sender Name |
fromoptional | text | The address must be listed in your GMail account's settings |
attachmentsoptional | array | Attachments |
in_reply_tooptional | text | Reply to this Message-ID |
draftrequired | boolean | Create draft without sending the actual email |
Details
- Id
gmail- Category
- Communication
- Tags
- email, google, inbox, mail, send, read
- Package
@activepieces/piece-gmail@0.11.6- Tier
- Built in