Xanxir
Xanxir

Reputation: 486

Only I can see my output from custom slash commands

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?

Upvotes: 9

Views: 6083

Answers (2)

chin90
chin90

Reputation: 101

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": [....]
}

Upvotes: 4

user94559
user94559

Reputation: 60133

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.

Upvotes: 21

Related Questions