Messaging API

The Unified Messaging API allow you to access different messaging and conversational systems to push and pull data from integrations like Gmail, Slack, Discord, and more.

Use Cases

  • Read all messages and ingest the contents into an AI model

You can see an example of how to use our Messaging API in our Messaging Demo Repo.

Handling threaded messages

Use the parent_id for maximum flexibility in handling threaded messages.

Note: parent_message_id and root_message_id are deprecated.

parent_id: Represents the immediate predecessor message in a thread.
This allows you to identify which message a given message directly replies to.

Threading relationships form a tree of messages, where each reply points to its parent

Replying to Messages

  • Set parent_id to the ID of the message being replied to.

This ensures the reply is properly threaded and appears under the correct message across all integrations that support threaded conversations.

Listing Messages in a Thread

You can retrieve messages within a thread using the parent_id relationship.

Using the expand Filter

When listing messages, you can set the expand filter to true to automatically include all nested descendants of a message, not just its immediate children.
This provides a full flat view of the thread hierarchy in a single query.

Consistency Across Integrations

Using the parent_id structure ensures:

  • Consistent message hierarchy across sender and receiver systems.
  • Simplified logic for reconstructing conversation trees.

If a message does not include a parent_id, it is treated as either:

  • A standalone message, or
  • The root of a new thread.

Working with Hierarchical Data in Messaging APIs

Messaging integrations typically organize data in a hierarchical (tree-like) structure. For detailed guidance on traversing hierarchical data, refer to our guide: How to traverse hierarchical data

Are we missing anything? Let us know
Was this page helpful?