Portal Community

draft/delete

Permanently delete a Gmail draft. The draft is removed from the Drafts folder and cannot be recovered.

When to Use

Configuration

Connection

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

Operation Fields

FieldTypeDefaultDescription
draftIdstring requiredGmail draft ID to permanently delete. Returned by draft/create or draft/getMany.

Sample Configuration

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

Validation Errors

ErrorCauseResolution
MISSING_FIELD: draftIddraftId is emptyEnsure upstream node provides a valid draft ID
DRAFT_NOT_FOUNDDraft does not exist or was already sent/deletedTreat as idempotent success if draft was already cleaned up
INVALID_CREDENTIALOAuth token expired or credential not foundRe-authenticate in BizFirst Credentials Manager
PERMISSION_DENIEDCredential lacks gmail.modify scopeRe-grant OAuth permissions with the correct scope

Output

Success Port

FieldTypeDescription
successbooltrue when the draft was permanently deleted
statusstringsuccess
errorCodestringEmpty on success

Error Port

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

Sample Output

{
  "success": true,
  "status": "success",
  "errorCode": ""
}

Expression Reference

ExpressionResolves ToExample Use
{{approval.rejectedDraftId}}Draft ID from rejected approval nodedraftId field
{{draftCreate.draftId}}Draft ID from upstream draft/createDelete after failed validation
{{loop.current.draftId}}Current draft ID in a batch cleanup LoopBatch draft deletion

Node Policies & GuardRails

PolicyRule
Draft Lifecycle ManagementAlways delete rejected or abandoned drafts — include a draft/delete node in all rejection/error branches of draft workflows
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
IdempotencyCalling draft/delete on a draft that no longer exists returns DRAFT_NOT_FOUND — handle this gracefully in the error port
Quota ManagementDraft delete operations cost minimal quota units — safe for batch cleanup workflows
No RecoveryDeleted drafts cannot be recovered — ensure the deletion is intentional and the draft content is no longer needed
Test IsolationTest delete workflows against a dedicated Gmail test account to avoid deleting production drafts

Examples

Example 1: Rejected Approval Cleanup

After a HIL approver rejects a draft, delete it from Gmail to prevent accidental sends.

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

Example 2: Error Path Cleanup

A CatchBlock in a draft-send workflow deletes the draft when a downstream validation error occurs.

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

Example 3: Stale Draft Batch Cleanup

A scheduled workflow lists all drafts older than 7 days and deletes them via a Loop node.

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