0

In SLACK, Is it possible to create commands for an app which post messages to different channels? This is what I am trying to achieve: I run a Slash command from my DM which will post a message in a channel, which I am not a part of. A member of that channel now runs another command to reply me and his response should be received by me either in my app’s messages or in the same channel but visible to me only. Can this be achieved ?

2 Answers2

0

A bot token, (xoxb) can send messages to any public channel using the chat.postMessage method and the [chat:write/public][1] scope. For that, the bot does not need to be a member of the channel. The bot can also send 1:1 DMs to users if you pass their user id as the channel parameter in a call to chat.postMessage but the bot won't be able to post into a private channel or multi-person DM it is not a member of. To send messages in-channel that can only be viewed by a specific user, check out [chat.postEphemeral][1], the user seeing this message must be a member of the channel.

sandra
  • 1,301
  • 3
  • 3
0


What you mentioned in the question can be achieved using Slack's 'Interactivity' features. (Slash Commands & App Shortcuts)

You'll need to implement code to capture 'command', and then use Slack's WebAPIs to achieve the result.
(Chat APIs)

Suyash Gaur
  • 2,481
  • 2
  • 9
  • 22