Mattermost, Inc.

"Channel" parameter in slash command payload not working


Slash command gets a JSON payload from PHP and prints correctly (i.e. printing the contents of “text”, but seems to ignore “channel”. No matter what this is set to, the output is posted to the channel the command was called from.

Steps to reproduce

Version 4.2.0 on server, run slash command /hello from off-topic returning payload {“response_type”: “in_channel”, “channel”: “town-square”, “text”: “hello world”}

Expected/observed behavior

Expect output to be piped to “town-square”, but instead it is displayed in “off-topic”.

Additional question

If this can be made to work, is there a way for a command to output to multiple channels at once? (e.g. an announce command that posts to off-topic, town-square and ‘announcements’ at the same time?)

@jezwilkinson What’s your use case? Is it that you’re posting an announcement with the slash command and would like it to be returned in town-square?

Essentially, yes. At the moment I’m still at the stage of testing what’s possible, but once it’s deployed to my team it would be useful for the outputs of certain bot commands to be sent to a “bot-output” channel no matter where they were run from (ideally it would be nice to be able to also have the announce command to print to multiple channels, but “sending to a single defined channel” is proving to be enough of a hurdle as-is)

Thanks @jezwilkinson , appreciate your feedback.

Would you like to contribute this in the feature idea forum so it can be discussed, upvoted and considered for a help wanted ticket?

Please include a link back to this forum issue. If you’re interested in implementing, please say so and we’ll prioritize the review.

You get 10 votes in the feature idea forum, and each one influences the future of the project.