thread/get
Retrieve a complete Gmail thread by its thread ID, including all messages in the conversation.
When to Use
- Full conversation context: Retrieve the complete email thread before drafting an AI-generated reply, so the model has full conversational context.
- Support ticket history: Fetch the entire thread for a support ticket to build a complete timeline of customer interactions.
- CRM thread sync: Retrieve a full email conversation and sync all messages in the thread to the CRM contact activity feed.
- Escalation analysis: Retrieve the thread when an escalation is triggered to analyze the full conversation history before routing to a senior agent.
- Thread summarization: Pass the full thread's messages to an AI node for summarization before creating a briefing document.
Configuration
Connection
| Field | Type | Description |
credentialId | Guid required | OAuth2 credential ID from BizFirst Credentials Manager. Requires gmail.readonly scope. |
Operation Fields
| Field | Type | Default | Description |
threadId | string required | — | Gmail thread ID to retrieve. All messages in the thread are returned. |
simple | bool optional | true | When true, returns simplified message objects (headers + metadata). When false, includes full body content for each message. |
returnOnlyMessages | bool optional | false | When 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
| Error | Cause | Resolution |
MISSING_FIELD: threadId | threadId is empty | Ensure upstream trigger or node provides a valid thread ID |
THREAD_NOT_FOUND | Thread does not exist or is inaccessible | Verify thread ID comes from the authenticated account |
INVALID_CREDENTIAL | OAuth token expired or credential not found | Re-authenticate in BizFirst Credentials Manager |
Output
Success Port
| Field | Type | Description |
threadId | string | Gmail thread ID |
historyId | string | The thread's history ID (used for change detection) |
snippet | string | Short preview from the most recent message |
messages | array | Array 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 |
status | string | success |
errorCode | string | Empty 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
| Expression | Resolves To | Example Use |
{{trigger.threadId}} | Thread ID from IMAP trigger or upstream node | threadId field |
{{threadGet.messages}} | Array of all messages in the thread | Pass to AI summarization node |
{{threadGet.messages | last | prop: 'from'}} | Sender of the most recent message | Reply routing logic |
{{threadGet.messages | length}} | Number of messages in the thread | Escalation trigger threshold |
Node Policies & GuardRails
| Policy | Rule |
| Credential Storage | Store OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration |
| PII Protection | Do not log thread message content in workflow execution history — thread data contains full email bodies and PII |
| Simple Mode Default | Use simple: true for metadata reads; use simple: false only when body content of all messages is required |
| Quota Management | Thread get costs 5–10 quota units depending on thread size — monitor usage on high-volume workflows |
| Large Thread Handling | Very long threads (100+ messages) may have large payloads — consider returnOnlyMessages: true and process messages individually |
| Test Isolation | Test 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
}