Portal Community

draft/getMany

List Gmail drafts in the authenticated account, with options to include spam/trash drafts and download attachments.

When to Use

Configuration

Connection

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

Operation Fields

FieldTypeDefaultDescription
returnAllbool optionalfalseWhen true, retrieves all drafts (ignores limit).
limitint optional50Maximum number of drafts to return when returnAll is false.
downloadAttachmentsbool optionalfalseWhen true, downloads attachment binaries for each draft. Use with caution — significantly increases response size.
includeSpamTrashbool optionalfalseWhen true, includes drafts from Spam and Trash folders in the results.

Sample Configuration

{
  "nodeType": "Gmail",
  "operation": "draft/getMany",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "returnAll": false,
  "limit": 20,
  "downloadAttachments": false,
  "includeSpamTrash": false
}

Validation Errors

ErrorCauseResolution
INVALID_CREDENTIALOAuth token expired or credential not foundRe-authenticate in BizFirst Credentials Manager
QUOTA_EXCEEDEDGmail API quota exhaustedReduce list frequency and implement backoff
LIMIT_EXCEEDEDlimit value exceeds supported maximumReduce limit value or use pagination

Output

Success Port

FieldTypeDescription
draftsarrayArray of draft summary objects
drafts[].draftIdstringGmail draft ID
drafts[].messageIdstringUnderlying message ID
drafts[].threadIdstringThread ID if draft is a reply
drafts[].snippetstringShort body preview text
statusstringsuccess
errorCodestringEmpty on success

Error Port

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

Sample Output

{
  "drafts": [
    {
      "draftId": "r9876543210abcdef",
      "messageId": "18e4c3d2e1f0a9b8",
      "threadId": "18e4c3d2e1f0a9b8",
      "snippet": "Dear Client, please find the proposal..."
    },
    {
      "draftId": "r1234567890fedcba",
      "messageId": "18e5d4e3f2a1b0c9",
      "threadId": "18e5d4e3f2a1b0c9",
      "snippet": "Hi Team, the weekly report is attached..."
    }
  ],
  "status": "success",
  "errorCode": ""
}

Expression Reference

ExpressionResolves ToExample Use
{{draftList.drafts}}Array of draft objectsLoop node input for batch processing
{{draftList.drafts[0].draftId}}First draft's IDPass to draft/get for full retrieval
{{draftList.drafts | length}}Count of returned draftsConditional logic based on draft count

Node Policies & GuardRails

PolicyRule
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
ReturnAll SafetyAvoid returnAll: true if the account may accumulate many drafts — set a reasonable limit for production workflows
Attachment DownloadsAvoid downloadAttachments: true for list operations — retrieve full draft content individually with draft/get only when needed
PII ProtectionDo not log draft snippet arrays in workflow execution history — snippets may contain PII
Quota ManagementDraft list operations cost minimal quota — safe for scheduled polling workflows
Test IsolationTest draft listing workflows against a dedicated Gmail test account before connecting production

Examples

Example 1: Batch Approval Queue

List all current drafts and present them as an approval queue in a Human-in-the-Loop workflow.

{
  "nodeType": "Gmail",
  "operation": "draft/getMany",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "returnAll": true,
  "downloadAttachments": false
}

Example 2: Scheduled Send Pipeline

A ScheduledTrigger fires at 9 AM, retrieves all staged drafts, and sends each via a Loop + send-draft flow.

{
  "nodeType": "Gmail",
  "operation": "draft/getMany",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "returnAll": false,
  "limit": 50
}

Example 3: Stale Draft Cleanup

List all drafts and pass to a Loop node that checks snippet for specific keywords and deletes matching stale drafts.

{
  "nodeType": "Gmail",
  "operation": "draft/getMany",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "returnAll": true
}