Search code examples
slack-apislack-commands

How to show failed command text in Slack chat input? (Slack API)


If you type "/remind dsafsafsafsa" in Slack (if you have the reminder bot) it will show an error message AND you will see the text "/remind dsafsafsafsa" in the chat input, so you can modify it to send the correct command.

I'm trying to replicate this in my slack application/bot. When I receive a command badly formatted I return an HTTP 200 json with a text, e.g. "Bad command". But the user entered command doesn't appear on the chat input. And that's bad because the user have to type the whole command again, when it would be easier that the user can just modify the command.

Is there a way to do this, in a similar way that reminder bot does it?


Solution

  • The built-in slash commands on Slack run on legacy architecture which is why most of them will show the behaviour you're describing. I'm afraid the newer slash commands available via the API don't behave this way. I'd recommend you show more details in your "Bad Command" return to give the end user more guidance. Similar to how Zoom does it. enter image description here