Threads & Replies
Confused about "Threads & Replies"?
Let us know how we can improve our documentation:
Threads and replies provide your users with a way to go into more detail about a specific topic.
This can be very helpful to keep the conversation organized and reduce noise. To create a thread you simply send a message with a parent_id
. Have a look at the example below:
show_in_channel
, the message will be visible both in a thread of replies as well as the main channel.Messages inside a thread can also have reactions, attachments and mention as any other message.
Thread Pagination
Copied!Confused about "Thread Pagination"?
Let us know how we can improve our documentation:
When you read a channel you do not receive messages inside threads. The parent message includes the count of replies which it is usually what apps show as the link to the thread screen. Reading a thread and paginating its messages works in a very similar way as paginating a channel.
Quote Message
Copied!Confused about "Quote Message"?
Let us know how we can improve our documentation:
Instead of replying in a thread, it's also possible to quote a message. Quoting a message doesn't result in the creation of a thread; the message is quoted inline.
To quote a message, simply provide the quoted_message_id
field when sending a message:
Based on the provided quoted_message_id
, the quoted_message
field is automatically enriched when querying channels with messages. Example response:
channel.query()
or querying message by its ID. Example: Message A
quotes Message B
and Message B
quotes Message C
. In this case it's not possible to access Message C
through Message A
directly. You have to fetch Message B
from API in order to access itThread List
Copied!Confused about "Thread List"?
Let us know how we can improve our documentation:
Query Threads
Copied!Confused about "Query Threads"?
Let us know how we can improve our documentation:
It is possible to query the list of threads that current user is participant of. This is useful to create thread list similar to what Slack or Discord has. Response will include threads with unread replies first, sorted by the latest reply timestamp in descending order. Threads with no unread replies will follow, also sorted by the latest reply timestamp in descending order.
You can also paginate over the thread list or request specific number of latest replies per thread.
Following is the list of supported options for querying threads:
name | type | description | default | optional |
---|---|---|---|---|
reply_limit | number | Number of latest replies to fetch per thread | 2 | ✓ |
participant_limit | number | Number of thread participants to request per thread | 100 | ✓ |
limit | number | Maximum number of threads to return in response | 10 | ✓ |
watch | boolean | If true, all the channels corresponding to threads returned in response will be watched | true | ✓ |
member_limit | number | Number of members to request per thread channel | 100 | ✓ |
Thread List Management
Copied!Confused about "Thread List Management"?
Let us know how we can improve our documentation:
ThreadManager
class offers built-in pagination handling for threads with own state store to access loaded threads. To access threads you can either subscribe to the ThreadManager
state or access the latest value by calling getLatestValue
on state property of the ThreadManager
.
ThreadManager
instance which can be accessed via threads property of the client (client.threads
).Event Handling Of Threads
Copied!Confused about "Event Handling Of Threads"?
Let us know how we can improve our documentation:
Each thread instance comes with registerSubscriptions
method which registers handlers to appropriate thread-related events. With subscriptions registered, the updates to the state are done automatically and can be accessed by subscribing to the state updates.
watch
parameter is required when querying for threads in this case as without it, the channel to which the thread is linked won't receive updates.If you're using ThreadManger
to manage your list of threads, you can call registerSubscriptions
method on the manager instance and the manager will automatically handle subscriptions (registration and cleanup) of the added and removed threads.
Get Thread By ID
Copied!Confused about "Get Thread By ID"?
Let us know how we can improve our documentation:
This endpoint returns a thread by the given threadId.
Update Thread Title and Custom Data
Copied!Confused about "Update Thread Title and Custom Data"?
Let us know how we can improve our documentation:
You can assign a title and any additional custom data to each thread.
Similarly to remove any custom property from thread:
Threads Unread Count
Copied!Confused about "Threads Unread Count"?
Let us know how we can improve our documentation:
Total number of unread threads is available in response of connectUser endpoint
If you would like to mark specific thread as read or unread, you can do that as following
To get unread count per thread for a current user, you can use the getUnreadCount
endpoint as following