Portal Community

thread/getMany

List and filter Gmail threads using search queries, label filters, date ranges, and read status criteria.

When to Use

Configuration

Connection

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

Operation Fields

FieldTypeDefaultDescription
returnAllbool optionalfalseWhen true, retrieves all matching threads (ignores limit).
limitint optional50Maximum number of threads to return.
simplebool optionaltrueWhen true, returns simplified thread objects with message summaries. When false, includes full message bodies.
labelIdsstring[] optionalFilter threads that have ALL of the specified label IDs.
includeSpamTrashbool optionalfalseWhen true, includes threads from Spam and Trash in results.
filterQstring optionalGmail search query string. Supports full Gmail query syntax.
readStatusenum optionalFilter by status: read or unread.
receivedAfterstring optionalISO date — only threads with messages received after this date.
receivedBeforestring optionalISO date — only threads with messages received before this date.
senderstring optionalFilter by sender email address.

Sample Configuration

{
  "nodeType": "Gmail",
  "operation": "thread/getMany",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "returnAll": false,
  "limit": 25,
  "simple": true,
  "labelIds": ["INBOX"],
  "readStatus": "unread",
  "receivedAfter": "2024-01-01"
}

Validation Errors

ErrorCauseResolution
INVALID_CREDENTIALOAuth token expired or credential not foundRe-authenticate in BizFirst Credentials Manager
INVALID_QUERY: filterQMalformed Gmail search queryValidate query in Gmail web UI first
INVALID_DATEDate string is not parseableUse ISO format: YYYY-MM-DD
QUOTA_EXCEEDEDGmail API quota exhaustedReduce list frequency; implement backoff

Output

Success Port

FieldTypeDescription
threadsarrayArray of thread objects
threads[].threadIdstringGmail thread ID
threads[].historyIdstringThread history ID
threads[].snippetstringPreview of the most recent message
threads[].messagesarrayArray of message summary objects in the thread
statusstringsuccess
errorCodestringEmpty on success

Error Port

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

Sample Output

{
  "threads": [
    {
      "threadId": "18e4a2f9d3c0b1a7",
      "historyId": "1234567",
      "snippet": "We'd like to move forward with the proposal...",
      "messages": [
        { "messageId": "18e4a2f9d3c0b1a7", "from": "client@example.com", "subject": "Re: Proposal", "date": "Mon, 15 Jan 2024 09:34:12 +0000" }
      ]
    }
  ],
  "status": "success",
  "errorCode": ""
}

Expression Reference

ExpressionResolves ToExample Use
{{threadList.threads}}Array of thread objectsLoop node input
{{threadList.threads[0].threadId}}First thread's IDPass to thread/get for full content
{{$now | dateFormat:'YYYY-MM-01'}}First day of current monthreceivedAfter for monthly report

Node Policies & GuardRails

PolicyRule
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
ReturnAll SafetyAvoid returnAll: true on large inboxes — set date filters and reasonable limits
Quota ManagementThread list costs 5 quota units per call — plan batch sizes carefully for high-volume workflows
PII ProtectionDo not log thread arrays in workflow execution history — they contain email content with PII
Query ValidationTest filterQ queries in Gmail web UI before deploying automated thread workflows
Test IsolationTest thread listing workflows against a dedicated Gmail test account

Examples

Example 1: Unread Support Thread Processing

Scheduled trigger retrieves all unread inbox threads hourly for support routing.

{
  "nodeType": "Gmail",
  "operation": "thread/getMany",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "labelIds": ["INBOX"],
  "readStatus": "unread",
  "limit": 50,
  "simple": true
}

Example 2: Client Correspondence Archive

Retrieve all threads from a departing client for archival before account closure.

{
  "nodeType": "Gmail",
  "operation": "thread/getMany",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "sender": "{{client.email}}",
  "returnAll": true,
  "simple": true
}

Example 3: Monthly Conversation Report

List all threads from the current month for SLA and volume analytics.

{
  "nodeType": "Gmail",
  "operation": "thread/getMany",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "receivedAfter": "{{$now | dateFormat:'YYYY-MM-01'}}",
  "receivedBefore": "{{$now | dateFormat:'YYYY-MM-DD'}}",
  "returnAll": true
}