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 root_message_id
field along with the parent_message_id
for maximum flexibility in handling threaded messages.
root_message_id
: Represents the ID of the root message of a thread. Use it to identify the entire thread and reply to the root message or fetch all messages.
parent_message_id
: Represents the ID of the immediate predecessor message in the thread. Use it to identify a specific message to which the current message directly replies.
Replying to Messages
Using root_message_id
: Replies to the root message of the thread. Ensures that the reply is treated as part of the thread on both sender and receiver sides.
Using parent_message_id
: Replies to a specific message (the immediate predecessor) within the thread.
Listing Messages in a Thread
To retrieve all messages within a thread, use the root_message_id
.
Note: Pagination is not supported when using root_message_id
for listing.
Consistency Across Sender and Receiver
By using root_message_id
or parent_message_id
, the thread's structure is preserved, ensuring consistency between the sender and receiver's views of the conversation. If both are provided, then parent_message_id
is prioritised.
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