Slack just launched threaded messages yesterday, and we’re pretty excited about them. We think it’s going to change the dynamic of how people communicate in Slack, especially with bots. A new version of email@example.com has been published that supports threaded messages and offers some great features to take advantage of them.
Keepin’ it in the thread
The more we tried threads and experimented with how bots make use of them, the more obvious it felt that bots should keep conversations in a thread if that’s where they started. For example, if you ask a bot for help inside a thread, you expect to see a response inside that thread, not back in the main channel. Keep your bot classy.
In the latest version of Slapp this behavior is the default. We think this will help bot conversations flow more naturally. If finer grained control is needed, there are two new functions to support that as well.
thread() and unthread() the needle
To ensure new messages become part of a thread, use the thread() function on a message.
msg.thread().say('This message will be part of a thread')
Conversely, use unthread() to ensure a message is created in the main channel.
msg.unthread().say('This message will not be part of the thread')
To help demonstrate how you can take advantage of threaded messages using Slapp, here’s a quick video along with the corresponding code.
May the threads forever be in your favor!