Portal Community

draft/create

Save an email as a Gmail draft without sending, enabling human review and approval workflows before delivery.

When to Use

Configuration

Connection

FieldTypeDescription
credentialIdGuid requiredOAuth2 credential ID from BizFirst Credentials Manager. Requires gmail.send scope.

Operation Fields

FieldTypeDefaultDescription
messagestring requiredEmail body content. HTML or plain text depending on emailType.
threadIdstring optionalThread ID to associate this draft as a reply. When set, the draft will be in-thread with the specified conversation.
fromAliasstring optionalSend-as alias email address (must be configured in Gmail settings). Defaults to the authenticated account's primary address.
subjectstring optionalEmail subject line. Required for new emails; optional for thread replies (inherits thread subject).
emailTypeenum optionalhtmlContent type: html or text.
replyTostring optionalReply-To email address for the draft.
ccListstring optionalComma-separated CC email addresses.
bccListstring optionalComma-separated BCC email addresses.
attachmentBinaryFieldsstring[] optionalBinary field names from upstream node outputs to attach to the draft.

Sample Configuration

{
  "nodeType": "Gmail",
  "operation": "draft/create",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "subject": "Proposal for {{client.name}} — {{project.title}}",
  "message": "<p>Dear {{client.name}},</p><p>Please find the project proposal attached.</p>",
  "emailType": "html",
  "ccList": "manager@bizfirstai.com",
  "attachmentBinaryFields": ["proposalPdf"]
}

Validation Errors

ErrorCauseResolution
MISSING_FIELD: messageDraft body is emptyProvide non-empty message content
INVALID_CREDENTIALOAuth token expired or credential not foundRe-authenticate in BizFirst Credentials Manager
THREAD_NOT_FOUNDProvided threadId does not existVerify the thread ID from the authenticated account
INVALID_ALIASfromAlias is not configured in Gmail send-as settingsConfigure the alias in Gmail Settings > Accounts before using

Output

Success Port

FieldTypeDescription
draftIdstringGmail draft ID — use this to retrieve or delete the draft later
messageIdstringThe underlying message ID of the draft
threadIdstringThread ID the draft belongs to
labelIdsstring[]Labels applied (typically ["DRAFT"])
statusstringsuccess
errorCodestringEmpty on success

Error Port

On failure, routes to the error port with status: "error", errorCode, and errorMessage.

Sample Output

{
  "draftId": "r9876543210abcdef",
  "messageId": "18e4c3d2e1f0a9b8",
  "threadId": "18e4c3d2e1f0a9b8",
  "labelIds": ["DRAFT"],
  "status": "success",
  "errorCode": ""
}

Expression Reference

ExpressionResolves ToExample Use
{{client.name}}Client name from CRM or upstream dataSubject and body personalization
{{draftCreate.draftId}}Draft ID from this node's outputPass to approval node or draft/delete
{{proposal.pdfBinary}}PDF binary from document generator nodeattachmentBinaryFields
{{thread.id}}Thread ID for in-thread draft replythreadId field

Node Policies & GuardRails

PolicyRule
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
Draft LifecycleAlways delete drafts that are not sent — use draft/delete in the error path or after rejection to avoid inbox clutter
PII ProtectionDo not log draft content in workflow execution history — drafts contain PII and pre-send content
Review WorkflowWhen using drafts for human review, implement a Human-in-the-Loop (HIL) approval node before the send step
Quota ManagementDraft creation uses gmail.send quota — counts toward daily send limits even though the message is not delivered
Test IsolationTest draft workflows against a dedicated Gmail test account to avoid creating unintended drafts in production inboxes

Examples

Example 1: Proposal Draft for Manager Review

Generate a client proposal email, create it as a draft, then pause for manager approval before sending.

{
  "nodeType": "Gmail",
  "operation": "draft/create",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "subject": "Proposal — {{project.name}}",
  "message": "{{proposalTemplate.html}}",
  "emailType": "html",
  "attachmentBinaryFields": ["proposalDocBinary"]
}

Example 2: AI-Generated Support Reply Draft

An AI agent generates a reply draft that a support agent reviews and sends from their Gmail inbox.

{
  "nodeType": "Gmail",
  "operation": "draft/create",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "threadId": "{{ticket.gmailThreadId}}",
  "message": "{{aiAgent.generatedReplyHtml}}",
  "emailType": "html"
}

Example 3: Scheduled Newsletter Draft

A workflow prepares newsletter drafts at month-end for a scheduled send on the first day of the next month.

{
  "nodeType": "Gmail",
  "operation": "draft/create",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "subject": "BizFirst Monthly Digest — {{$now | dateFormat:'MMMM YYYY'}}",
  "message": "{{newsletter.compiledHtml}}",
  "emailType": "html"
}