slackslack-apislack-block-kit

Subscribing an User to a Thread using the Slack API


This is the first question I ask in quite a few years :-)

I've gotten to play around with the Slack API recently to write up some notification bot. As part of the bot workflow, I want it to send messages to a channel, where it will create a thread based on the initial message.

This is done already, by using the chat.postMessage verb and thread_ts attributes. However, messages to threads that an user is not involved or subscribed to will not send any notifications.

My question, is it possible to have a a bot subscribe you to a thread? This is explained in this Slack KB post, where you can manually sign in to notifications using the three dotted menu, or by pinging the user.

My initial idea is based on the Block Kit interface, where clicking a button would subscribe you to the channel, providing more visibility than the three dotted menu approach. Is this something feasible?

I haven't found any reference to this on the Slack API method Reference, but perhaps it's hidden somewhere else.

As a fallback mechanism, I will think on editing the original message with a list of "subscribers" so that they will notified of updates to the thread.


Solution


  • As you already mentioned, there is no publicly available API to subscribe to thread notifications.
    I'll recommend dropping a message to Slack Support to ask about any private API.

    Internally for their client, they use following APIs:

    https://{{domain}}.slack.com/api/subscriptions.thread.add
    https://{{domain}}.slack.com/api/subscriptions.thread.remove
    

    I am curious about your fallback mechanism.
    Do you intend to tag relevant parties in the original message?
    You can try to tag them in a reply to the original message, this way the original message remains tidy.