Portal Community

thread/get

Retrieve a complete Gmail thread by its thread ID, including all messages in the conversation.

When to Use

Configuration

Connection

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

Operation Fields

FieldTypeDefaultDescription
threadIdstring requiredGmail thread ID to retrieve. All messages in the thread are returned.
simplebool optionaltrueWhen true, returns simplified message objects (headers + metadata). When false, includes full body content for each message.
returnOnlyMessagesbool optionalfalseWhen true, returns only the messages array without thread-level metadata (threadId, historyId, snippet).

Sample Configuration

{
  "nodeType": "Gmail",
  "operation": "thread/get",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "threadId": "{{trigger.threadId}}",
  "simple": false,
  "returnOnlyMessages": false
}

Validation Errors

ErrorCauseResolution
MISSING_FIELD: threadIdthreadId is emptyEnsure upstream trigger or node provides a valid thread ID
THREAD_NOT_FOUNDThread does not exist or is inaccessibleVerify thread ID comes from the authenticated account
INVALID_CREDENTIALOAuth token expired or credential not foundRe-authenticate in BizFirst Credentials Manager

Output

Success Port

FieldTypeDescription
threadIdstringGmail thread ID
historyIdstringThe thread's history ID (used for change detection)
snippetstringShort preview from the most recent message
messagesarrayArray of message objects in the thread (oldest first). Each contains: messageId, threadId, snippet, from, to, subject, date, labelIds, and (when simple:false) text, html, headers, attachments
statusstringsuccess
errorCodestringEmpty on success

Error Port

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

Sample Output

{
  "threadId": "18e4a2f9d3c0b1a7",
  "historyId": "1234567",
  "snippet": "Thanks for the update. We'll proceed with the proposal...",
  "messages": [
    {
      "messageId": "18e4a2f9d3c0b1a7",
      "from": "client@example.com",
      "to": "sales@bizfirstai.com",
      "subject": "Re: Project Alpha Proposal",
      "date": "Mon, 15 Jan 2024 09:34:12 +0000",
      "snippet": "Hi, I'd like to discuss the proposal...",
      "labelIds": ["INBOX"]
    },
    {
      "messageId": "18e4b3c1a2d4e5f6",
      "from": "sales@bizfirstai.com",
      "to": "client@example.com",
      "subject": "Re: Project Alpha Proposal",
      "date": "Mon, 15 Jan 2024 11:02:44 +0000",
      "snippet": "Thanks for your interest. Here are the details...",
      "labelIds": ["SENT"]
    }
  ],
  "status": "success",
  "errorCode": ""
}

Expression Reference

ExpressionResolves ToExample Use
{{trigger.threadId}}Thread ID from IMAP trigger or upstream nodethreadId field
{{threadGet.messages}}Array of all messages in the threadPass to AI summarization node
{{threadGet.messages | last | prop: 'from'}}Sender of the most recent messageReply routing logic
{{threadGet.messages | length}}Number of messages in the threadEscalation trigger threshold

Node Policies & GuardRails

PolicyRule
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
PII ProtectionDo not log thread message content in workflow execution history — thread data contains full email bodies and PII
Simple Mode DefaultUse simple: true for metadata reads; use simple: false only when body content of all messages is required
Quota ManagementThread get costs 5–10 quota units depending on thread size — monitor usage on high-volume workflows
Large Thread HandlingVery long threads (100+ messages) may have large payloads — consider returnOnlyMessages: true and process messages individually
Test IsolationTest thread retrieval workflows against a dedicated Gmail test account

Examples

Example 1: Full Thread for AI Reply Generation

Retrieve the full thread (with bodies) to pass to an AI agent for context-aware reply generation.

{
  "nodeType": "Gmail",
  "operation": "thread/get",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "threadId": "{{imapTrigger.threadId}}",
  "simple": false
}

Example 2: Support Ticket History

Retrieve the thread's message list to display the full conversation history in a ticket management dashboard.

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

Example 3: Thread Escalation Analysis

When a thread exceeds a message count threshold, retrieve the full thread for escalation review.

{
  "nodeType": "Gmail",
  "operation": "thread/get",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "threadId": "{{escalation.threadId}}",
  "simple": false,
  "returnOnlyMessages": true
}