Portal Community

thread/untrash

Restore a trashed Gmail thread and all its messages back to the inbox.

30-Day Window: Threads remain recoverable from trash for 30 days. After that, they are permanently auto-deleted. thread/untrash must be called within this window.

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 restore from trash. All messages in the thread are restored together.

Sample Configuration

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

Validation Errors

ErrorCauseResolution
MISSING_FIELD: threadIdthreadId is emptyProvide a valid thread ID
THREAD_NOT_FOUNDThread not in trash or permanently deletedVerify thread is within the 30-day recovery window; permanently deleted threads cannot be recovered
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 restored from 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
{{recoveryRequest.threadId}}Thread ID from recovery form or eventthreadId field
{{errorHandler.trashedThreadId}}Thread ID recorded before erroneous trash actionRollback in error recovery flow
{{ticket.reopenedThreadId}}Thread ID from re-opened support ticket eventRestore thread on ticket reopen

Node Policies & GuardRails

PolicyRule
30-Day WindowThreads are permanently deleted from trash after 30 days — recovery workflows must execute within this window
All Messages RestoredUntrashing a thread restores ALL messages in the thread — the entire conversation is returned to the inbox
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
Audit LoggingLog the untrash action (threadId, timestamp, reason) in an audit trail for compliance tracking
Quota ManagementThread untrash operations cost minimal quota — safe for use in recovery workflows
Test IsolationTest restore workflows against a dedicated Gmail test account

Examples

Example 1: False-Positive Thread Recovery

A review node detects a misclassified spam thread and restores the entire conversation.

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

Example 2: Support Ticket Re-open

When a support ticket is re-opened, restore the original Gmail thread to the active inbox.

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

Example 3: Workflow Error Rollback

A CatchBlock detects that a trash operation was incorrectly triggered and restores the thread.

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