Portal Community

thread/trash

Move an entire Gmail thread and all its messages to the trash. Recoverable for 30 days.

Recommended Deletion Method: thread/trash is the safe default for removing email conversations — all messages in the thread are moved to trash and remain recoverable for 30 days. Use thread/delete only when permanent removal is explicitly required.

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 move to trash. All messages in the thread are trashed together.

Sample Configuration

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

Validation Errors

ErrorCauseResolution
MISSING_FIELD: threadIdthreadId is emptyProvide a valid thread ID
THREAD_NOT_FOUNDThread does not exist or is already trashedHandle gracefully — thread may have been trashed previously
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 moved to trash
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
{{resolvedTicket.gmailThreadId}}Thread ID from resolved support ticketthreadId field
{{imapTrigger.threadId}}Thread ID from IMAP triggerPost-processing cleanup
{{loop.current.threadId}}Current thread in a batch LoopBatch thread trash operation

Node Policies & GuardRails

PolicyRule
Preferred Over DeleteUse thread/trash as the default for all thread removal scenarios — provides 30-day recovery window
All Messages AffectedTrashing a thread moves ALL messages in the thread — verify the entire thread should be removed before invoking
30-Day Recovery WindowTrashed threads auto-permanently-delete after 30 days — run untrash workflows within this window if recovery is needed
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
Quota ManagementThread trash operations cost minimal quota — safe for batch workflows
Test IsolationTest thread trash workflows against a dedicated Gmail test account

Examples

Example 1: Resolved Ticket Thread Cleanup

After a support ticket is marked resolved and archived in the help-desk, trash the Gmail thread.

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

Example 2: Batch Processed Thread Cleanup

After extracting data from multiple threads via a Loop, trash all processed threads.

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

Example 3: Spam Thread Bulk Trash

Classified spam threads are trashed (not permanently deleted) to allow false-positive recovery.

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