Introducing Threads 2.0

Nash R.
Thierry S.
Nash R. & Thierry S.
Published February 7, 2024
Threads 2.0 announcement blog post

Threads are a popular feature among mainstream chat applications and a great way to focus the conversation without cluttering up a user’s main feed and channel. Apps like Discord and Slack have set the bar regarding user experience and the features or behavior people expect when using threads.

Today, Stream is releasing several improvements to our threads functionality. With our latest update, developers can now set titles, query unread counts, and retrieve messages in a thread, allowing them to more easily build threaded experiences similar to those of Slack or Discord.

Chat thread example

From a more technical perspective, this means that Stream threads can:

  • Attach custom data and titles
  • Automatically create a thread from a message reply
  • Create a dedicated endpoint to fetch all threads a user participates in
  • Fetch more information about a single thread via the API and even update it
  • Track unread counts and read states at the thread level
  • Include an unread_threads field for all endpoints that return unread counts
  • Title threads based on the text of the parent message, like Discord

As an example, using our Javascript SDK, developers can work with the Threads API in a few ways:

javascript
const client = StreamChat.getInstance('api_key');
await client.connectUser({ id: 'user_id' }, 'user_token');
await threads = await client.queryThreads();

for (const thread of threads) {
  console.log(thread.participants);
  console.log(thread.latestReplies);
  console.log(thread.parentMessage.text)
}

When a user replies to a message, the Stream backend creates a thread object under the hood. Users can then give a thread a title and image or set other custom properties by calling partialUpdateThread.

Starting today, the Threads API is available on the Stream Chat API and Javascript client SDK, with additional SDKs rolling out soon. If you're currently working on an app that can benefit from our enhanced threads support, be sure to contact our team or send us an email to product@getstream.io. We’d love to hear your feedback as we try to learn as much as possible while rolling out this new feature.

decorative lines
Integrating Video With Your App?
We've built an audio and video solution just for you. Launch in days with our new APIs & SDKs!
Check out the BETA!