View as Markdown
Gmail icon

Gmail ACTION

Create Draft

Create an unsent draft in the authenticated Gmail account. Same parameter shape as Send Email — the difference is the message is saved to Drafts instead of being sent. For a reply-draft, pass inReplyToMessageId (from Find Emails / Get Thread); the subject, References, In-Reply-To, and threadId are derived from the referenced message. bodyType controls whether body is treated as plain text (default) or HTML. To draft to yourself, pass "me" in to — the action resolves it to the authenticated user's email address. No pre-call to Get Current User required. Attachments use file-ref inputs and require matching attachmentFilenames[] entries. See the documentation.
  • Action
  • Writes data
  • OAuth
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Gmail account once, then configure and run Create Draft from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "gmail-create-draft",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    gmail: { authProvisionId: "apn_xxxxxxx" },
    to: ["To"],
    cc: ["Cc"],
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Create Draft inputs
Property Type Description
to To string[]
Recipient email addresses. Pass "me" to draft to yourself — the action resolves it to the authenticated user's email address.
Optional
cc Cc string[]
Cc recipient email addresses. Pass "me" to include yourself.
Optional
bcc Bcc string[]
Bcc recipient email addresses. Pass "me" to include yourself.
Optional
subject Subject string
Subject line. When inReplyToMessageId is set, the subject is derived from the replied-to message with Re: prefixed and this value is ignored.
Optional
body Email Body string
Include an email body as either plain text or HTML. If HTML, make sure to set the "Body Type" prop to html.
Required
bodyType Body Type string
Choose to send as plain text or HTML. Defaults to plaintext.
Optional
fromName From Name string
Specify the name that will be displayed in the "From" section of the email.
Optional
fromEmail From Email string
Specify the email address that will be displayed in the "From" section of the email.
Optional Dynamic
replyTo Reply To string
Specify the email address that will appear on the "Reply-To" field, if different than the sender's email.
Optional
inReplyToMessageId In Reply To Message ID string
To send this email as a reply, pass the id of any message in the target thread (from Find Emails or Get Thread). The action will preserve References/In-Reply-To headers, thread correctly, and auto-prefix Re: on the subject.
Optional
replyAll Reply All boolean
When inReplyToMessageId is set, fan-out recipients to the original From/To/Cc (minus the user's own address). Ignored when inReplyToMessageId is blank.
Optional
attachmentFilenames Attachment Filenames string[]
Filenames for each attached file (include the extension, e.g. report.pdf, dna.txt). Must be the same length as attachments — index i in this list pairs with index i in attachments.
Optional
attachments Attachments string[]
Files to attach. Each entry is either a public URL or a path under /tmp (e.g. /tmp/dna.txt). Must be the same length as attachmentFilenames — index i here pairs with index i there.
Optional
syncDir SyncDir dir
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
gmail-create-draft
Version
0.2.3
App
Gmail
Authentication
OAuth
Read-only
No
Destructive
No
Open world
Yes