Portal Community

message/delete

Permanently delete a Gmail message, bypassing the trash. This action is irreversible.

Permanent Deletion: message/delete bypasses the trash and permanently removes the message. It cannot be recovered. For recoverable deletion, use message/trash instead.

When to Use

Configuration

Connection

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

Operation Fields

FieldTypeDefaultDescription
messageIdstring requiredGmail message ID to permanently delete. Ensure this is verified before passing to the node.

Sample Configuration

{
  "nodeType": "Gmail",
  "operation": "message/delete",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "messageId": "{{gdprErasure.targetMessageId}}"
}

Validation Errors

ErrorCauseResolution
MISSING_FIELD: messageIdmessageId is empty or not providedEnsure the upstream node provides a valid Gmail message ID
MESSAGE_NOT_FOUNDMessage does not exist or already deletedVerify the message ID; treat as idempotent success if already deleted
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 message 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
{{gdprErasure.targetMessageId}}Message ID from GDPR erasure request datamessageId field
{{testCleanup.sentMessageId}}Message ID from previous test send nodeCleanup after test assertion
{{loop.current.messageId}}Current message ID in a Loop node iterationBatch deletion loop

Node Policies & GuardRails

PolicyRule
Use Trash FirstDefault to message/trash for all deletion scenarios — use message/delete only after explicit legal or compliance confirmation
GDPR ComplianceOnly invoke for GDPR right-to-erasure after legal team confirmation — log the erasure event in an audit system before deletion
Irreversibility WarningThis action cannot be undone — implement an approval node (HIL) upstream for production delete workflows
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
Audit LoggingAlways log the message ID, timestamp, and deletion reason in an audit trail before executing deletion
Test IsolationOnly run automated deletion workflows against dedicated test Gmail accounts — never point at production inbox during development

Examples

Example 1: GDPR Erasure Workflow

After legal team approves an erasure request via an approval node, permanently delete the target message.

{
  "nodeType": "Gmail",
  "operation": "message/delete",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "messageId": "{{gdprRequest.gmailMessageId}}"
}

Example 2: Test Email Cleanup

In an automated test workflow, delete the test email after verifying it was received correctly.

{
  "nodeType": "Gmail",
  "operation": "message/delete",
  "credentialId": "test-account-credential-id",
  "messageId": "{{testSend.messageId}}"
}

Example 3: Credential Purge After Extraction

After extracting a one-time API token from an email, immediately delete the message to prevent exposure.

{
  "nodeType": "Gmail",
  "operation": "message/delete",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "messageId": "{{credentialEmail.messageId}}"
}