Skip to main content

Overview

Threads group related messages into conversations, making it easy to track email exchanges. Sendook automatically creates and manages threads for both sent and received emails.

How Threads Work

Every message in Sendook belongs to a thread:
  • New conversations automatically create a new thread
  • Replies are added to the existing thread
  • Each thread contains an ordered list of all messages in the conversation
  • Thread detection works automatically using email headers
Threads work similarly to email clients like Gmail, where related messages are grouped together in a conversation view.

Automatic Thread Creation

For Sent Emails

When you send a new email, Sendook automatically creates a thread:

For Received Emails

When someone emails your inbox:
  1. First email - Creates a new thread
  2. Reply to your email - Added to existing thread (detected via email headers)
  3. New subject - Creates a new thread

Thread Detection Logic

Sendook uses email headers to detect replies and maintain threads:
  1. References header - Contains the message ID of the original email
  2. In-Reply-To header - References the direct parent message
  3. Subject matching - Checks for “Re:” prefix and subject similarity
When a reply is detected:
  • The message is added to the existing thread
  • The thread’s messages array is updated
  • The threadId remains the same
Thread detection works automatically—you don’t need to manually specify thread IDs when sending replies.

Retrieving Threads

List All Threads

Get all threads for an inbox:

Get a Specific Thread

Retrieve a thread with all its messages:
The messages array contains message IDs in chronological order, making it easy to reconstruct the conversation timeline.

Reconstructing Conversations

To display a full conversation, combine thread and message data:

Thread Properties

Each thread has the following properties:

Use Cases

Track entire support conversations from initial inquiry to resolution. Display all messages in a thread to support agents for context.
Analyze conversation patterns like average thread length, response times, and resolution rates.
Track the status of conversations (open, pending, resolved) by associating metadata with thread IDs in your database.
Use thread history to generate contextual auto-replies with AI.

Working with Replies

When you reply to a message, it’s automatically added to the thread:

Thread Lifecycle

  1. Creation - A new message creates a new thread
  2. Growth - Replies are added to the thread’s messages array
  3. Persistence - Threads exist permanently (not automatically deleted)
  4. No deletion endpoint - Currently, threads cannot be manually deleted
Threads are created and updated automatically. There’s no API to manually create or delete threads.

Best Practices

Store thread IDs - When building applications, store thread IDs alongside your own data (e.g., support tickets, order IDs) to easily reference conversations.
Use threads for context - When processing webhooks, fetch the thread to understand the full conversation context before responding.
Monitor thread activity - Track the updatedAt timestamp to identify active conversations vs. stale threads.
Display chronologically - The messages array is already in chronological order—use it directly to display conversations.

Filtering Messages by Thread

While there’s no direct “filter by thread” endpoint, you can:
  1. Get the thread to retrieve message IDs
  2. Fetch only the messages you need

Thread Metadata

Threads themselves don’t store metadata like subject, participants, or status. To add custom metadata:

Next Steps

Sending Emails

Learn how replies create and update threads

Receiving Emails

Understand thread detection for incoming emails

Webhooks

Use webhooks to track thread activity

API Reference

View complete thread API documentation