How to display an interactive message to a channel with a slash command EXCEPT to the person evoking it?

Viewed 161

I created an interactive message that gets called via a slash command which gets distributed to the entire channel. Everything works fine. But I can't for the life of me figure out how to limit the message to the entire channel but to the person evoking it. Right now the message goes to everyone including the person that invoked it. If you've ever used /poll, the poll goes out to everyone but the person who created it.

If anyone knows how to do this, can you point me in the right direction?

1 Answers

The response message from a slash command can be only one of two things:

  • an ephemeral response, which can be seen by the user who issued the command only
  • an in_channel response, which can be seen by everyone in the channel

There is no feature or switch so that the response message would not be visible to the issuing user.

You can however build a workaround and manually send every user except the one issuing the command an ephemeral message. Here is an outline of how that would work:

There are some significant caveat to this workaround:

  • You app needs a lot of additional scopes to be allowed to retrieve the member list and send messages (see documentation of those API methods for details)
  • There is rate limit of about 1 message per second, so it might take quite some time to send those message to all user depending on how big the group is
  • your slash command needs to respond with 3 seconds. So you will need to implement some fancy multi-threading to be able to send all those messages.
  • To make that work in private channels you have to work with an additional bot user

That would get you the result you are asking for, but there are some caveats:

Related