Portal Community

draft/get

Retrieve a specific Gmail draft by its draft ID, including full message content and optionally downloaded attachments.

When to Use

Configuration

Connection

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

Operation Fields

FieldTypeDefaultDescription
draftIdstring requiredGmail draft ID to retrieve. Returned by draft/create or draft/getMany.
downloadAttachmentsbool optionalfalseWhen true, downloads attachment binary data and includes it in the output.

Sample Configuration

{
  "nodeType": "Gmail",
  "operation": "draft/get",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "draftId": "{{draftCreate.draftId}}",
  "downloadAttachments": false
}

Validation Errors

ErrorCauseResolution
MISSING_FIELD: draftIddraftId is emptyEnsure upstream node (draft/create or draft/getMany) provides a valid draft ID
DRAFT_NOT_FOUNDDraft does not exist or was already sent/deletedVerify the draft ID is current; drafts are removed when sent
INVALID_CREDENTIALOAuth token expired or credential not foundRe-authenticate in BizFirst Credentials Manager

Output

Success Port

FieldTypeDescription
draftIdstringGmail draft ID
messageIdstringUnderlying message ID
threadIdstringThread ID if draft is a reply
fromstringDraft sender address
tostringDraft recipient(s)
subjectstringDraft subject line
snippetstringShort body preview
htmlstringHTML body of the draft
textstringPlain text body of the draft
attachmentsarrayAttachment metadata (filename, mimeType, size)
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",
  "from": "sender@bizfirstai.com",
  "to": "client@example.com",
  "subject": "Proposal — Project Alpha",
  "snippet": "Dear Client, please find the project proposal attached...",
  "html": "<p>Dear Client...</p>",
  "text": "Dear Client...",
  "attachments": [
    { "filename": "proposal.pdf", "mimeType": "application/pdf", "size": 45230 }
  ],
  "status": "success",
  "errorCode": ""
}

Expression Reference

ExpressionResolves ToExample Use
{{draftCreate.draftId}}Draft ID from upstream draft/create nodedraftId field
{{draftGet.subject}}Draft subject for approval notificationHIL approval node message
{{draftGet.html}}Draft HTML body for content verificationValidation rule input
{{draftGet.attachments[0].size}}Size of first attachment in bytesFile size validation check

Node Policies & GuardRails

PolicyRule
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
PII ProtectionDo not log draft content in workflow execution history — drafts contain pre-send email content which may include PII
Draft LifecycleAfter retrieving a draft for inspection, ensure the workflow either sends it or deletes it — do not leave stale drafts in the inbox
Quota ManagementDraft get operations cost minimal quota units — safe for frequent use in approval workflows
Attachment DownloadsOnly enable downloadAttachments: true when binary content is required for the workflow — unnecessary downloads waste memory
Test IsolationTest draft retrieval workflows against a dedicated Gmail test account

Examples

Example 1: Pre-Approval Content Check

Retrieve a draft to include a subject/snippet preview in the approval request sent to a manager.

{
  "nodeType": "Gmail",
  "operation": "draft/get",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "draftId": "{{draftCreate.draftId}}"
}

Example 2: Attachment Size Validation

Retrieve draft with attachment metadata to verify the attached file does not exceed the email size limit.

{
  "nodeType": "Gmail",
  "operation": "draft/get",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "draftId": "{{draftCreate.draftId}}",
  "downloadAttachments": false
}

Example 3: Content Modification Pipeline

Retrieve draft content, pass through a transformation node, delete old draft, and create an updated one.

{
  "nodeType": "Gmail",
  "operation": "draft/get",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "draftId": "{{draftStore.savedDraftId}}"
}