Portal Community

thread/delete

Permanently delete an entire Gmail thread and all its messages. This action is irreversible.

Permanent — All Messages Deleted: thread/delete permanently removes ALL messages in the thread, not just the most recent one. This bypasses the trash. For recoverable deletion, use thread/trash instead.

When to Use

Configuration

Connection

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

Operation Fields

FieldTypeDefaultDescription
threadIdstring requiredGmail thread ID to permanently delete. ALL messages in the thread are removed.

Sample Configuration

{
  "nodeType": "Gmail",
  "operation": "thread/delete",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "threadId": "{{gdprErasure.targetThreadId}}"
}

Validation Errors

ErrorCauseResolution
MISSING_FIELD: threadIdthreadId is emptyProvide a valid thread ID
THREAD_NOT_FOUNDThread does not exist or already deletedTreat as success in cleanup workflows; thread was already removed
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 thread 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.targetThreadId}}Thread ID from GDPR erasure requestthreadId field
{{loop.current.threadId}}Current thread in a batch deletion LoopBulk thread deletion
{{testThread.threadId}}Thread ID from test setup nodeTest cleanup

Node Policies & GuardRails

PolicyRule
Use Trash FirstDefault to thread/trash for all deletion scenarios — use thread/delete only after explicit legal or compliance confirmation
All Messages Deletedthread/delete removes ALL messages in the thread permanently — this is significantly more destructive than message/delete
GDPR ComplianceOnly invoke for GDPR right-to-erasure after legal team confirmation — log the thread ID, timestamp, and reason before deletion
Human Approval GateImplement an approval node (HIL) upstream for production thread deletion workflows
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
Test IsolationTest deletion workflows against a dedicated Gmail test account — never point at production inbox

Examples

Example 1: GDPR Full Thread Erasure

After legal approval via HIL node, permanently delete the entire email thread associated with the erasure request.

{
  "nodeType": "Gmail",
  "operation": "thread/delete",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "threadId": "{{gdprRequest.gmailThreadId}}"
}

Example 2: Test Conversation Cleanup

After a test workflow creates and validates a multi-message thread, delete the entire thread in cleanup.

{
  "nodeType": "Gmail",
  "operation": "thread/delete",
  "credentialId": "test-credential-id",
  "threadId": "{{testSetup.createdThreadId}}"
}

Example 3: Spam Thread Permanent Removal

After classification identifies confirmed spam threads, permanently delete them to reclaim storage.

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