11

Suppose a user types a slash command inside a thread, as opposed to inside the main channel.

Is it possible for to include this information in the request sent to the bot? I want the bot to know where exactly the message came from so that it can reply in the same location (i.e. inside the thread and not in the main channel)

Judging by the docs, it seems information about threads is not sent. Here is the POST object that the docs say is sent:

token=gIkuvaNzQIHg97ATvDxqgjtO
&team_id=T0001
&team_domain=example
&enterprise_id=E0001
&enterprise_name=Globular%20Construct%20Inc
&channel_id=C2147483705
&channel_name=test
&user_id=U2147483697
&user_name=Steve
&command=/weather
&text=94070
&response_url=https://hooks.slack.com/commands/1234/5678
&trigger_id=13345224609.738474920.8088930838d88f008e0

Does anyone know if there is a way to do this?

CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
  • Not sure if slash commands work in threads. Looking at https://twitter.com/SlackHQ/status/977264888392413186, they didn't work in threads at least a few months ago... – Adil B Aug 21 '18 at 22:55
  • I believe it is [still not possible](https://medium.com/@brad.robertson/slack-threading-failure-threadfail-977859586d5a), but [these docs are promising](https://api.slack.com/docs/message-threading). Just appears custom slash commands are still no welcome inside threads :( – Craig Conover Sep 13 '18 at 22:24

1 Answers1

0

Custom slash commands are not supported within threads. From the documentation:

Limitations on use: Slash Commands cannot be used in message threads. Consider using app shortcuts for this purpose instead.

While the documentation lists app shortcuts as an alternative, you sadly won't receive thread id in the payload from shortcuts, so it's not useful for your issue. You can, however, do some other things based on app shortcuts, such as open a modal, and so on, so there's at least that.

jure
  • 492
  • 5
  • 8