9

I created a custom slash command in Slack. The backend code, not that it's important, is a Lambda function in Python in AWS.

My problem is that when I enter the slash command, I am the only one who can see the message. Otherwise, it works perfectly. Is there a way to get others to see the output from my custom slash command?

Xanxir
  • 476
  • 1
  • 8
  • 13

2 Answers2

21

See "'In Channel' vs. 'Ephemeral' responses" here: https://api.slack.com/slash-commands#responding_to_a_command.

By default, the response messages sent to commands will only be visible to the user that issued the command (we call these "ephemeral" messages). However, if you would like the response to be visible to all members of the channel in which the user typed the command, you can add a response_type of in_channel to the JSON response, like this:

{
    "response_type": "in_channel",
    "text": "It's 80 degrees right now.",
    "attachments": [
        {
            "text":"Partly cloudy today and tomorrow"
        }
    ]
}

When the response_type is in_channel, both the response message and the initial message typed by the user will be shared in the channel.

user94559
  • 59,196
  • 6
  • 103
  • 103
4

If you have a block in your JSON payload to slack (you used slacks block-kit) e.g

`"blocks": []`

you'll have to put the "response_type": "in_channel" above blocks for it to work :) e.g

{
    "response_type": "in_channel",
    "blocks": [....]
}
chin90
  • 101
  • 1
  • 3