draft/getMany
List Gmail drafts in the authenticated account, with options to include spam/trash drafts and download attachments.
When to Use
- Batch approval queue inspection: List all pending drafts to present a review queue to approvers in a Human-in-the-Loop workflow.
- Scheduled send pipeline: Retrieve all staged drafts created during the day and process them through a scheduled send workflow at a specific time.
- Draft cleanup automation: List all drafts, filter by age or subject pattern, and delete stale ones to maintain inbox hygiene.
- Draft inventory audit: Enumerate drafts for compliance reporting or content governance purposes.
- Multi-draft batch processing: Retrieve multiple drafts and process each through a Loop node for individual validation, modification, or deletion.
Configuration
Connection
| Field | Type | Description |
credentialId | Guid required | OAuth2 credential ID from BizFirst Credentials Manager. Requires gmail.readonly scope. |
Operation Fields
| Field | Type | Default | Description |
returnAll | bool optional | false | When true, retrieves all drafts (ignores limit). |
limit | int optional | 50 | Maximum number of drafts to return when returnAll is false. |
downloadAttachments | bool optional | false | When true, downloads attachment binaries for each draft. Use with caution — significantly increases response size. |
includeSpamTrash | bool optional | false | When 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
| Error | Cause | Resolution |
INVALID_CREDENTIAL | OAuth token expired or credential not found | Re-authenticate in BizFirst Credentials Manager |
QUOTA_EXCEEDED | Gmail API quota exhausted | Reduce list frequency and implement backoff |
LIMIT_EXCEEDED | limit value exceeds supported maximum | Reduce limit value or use pagination |
Output
Success Port
| Field | Type | Description |
drafts | array | Array of draft summary objects |
drafts[].draftId | string | Gmail draft ID |
drafts[].messageId | string | Underlying message ID |
drafts[].threadId | string | Thread ID if draft is a reply |
drafts[].snippet | string | Short body preview text |
status | string | success |
errorCode | string | Empty 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
| Expression | Resolves To | Example Use |
{{draftList.drafts}} | Array of draft objects | Loop node input for batch processing |
{{draftList.drafts[0].draftId}} | First draft's ID | Pass to draft/get for full retrieval |
{{draftList.drafts | length}} | Count of returned drafts | Conditional logic based on draft count |
Node Policies & GuardRails
| Policy | Rule |
| Credential Storage | Store OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration |
| ReturnAll Safety | Avoid returnAll: true if the account may accumulate many drafts — set a reasonable limit for production workflows |
| Attachment Downloads | Avoid downloadAttachments: true for list operations — retrieve full draft content individually with draft/get only when needed |
| PII Protection | Do not log draft snippet arrays in workflow execution history — snippets may contain PII |
| Quota Management | Draft list operations cost minimal quota — safe for scheduled polling workflows |
| Test Isolation | Test 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
}