Is it possible in SLACK to be integrated to a C# Web API and send a direct message to a every user? I know webhook is needed for it to send a direct message. The problem will be webhooks are different for every user.
-
2Yes, it is. What have you tried? – CodeCaster Jan 08 '19 at 10:51
-
https://api.slack.com/ – FakeCaleb Jan 08 '19 at 10:51
-
Welcome to [so]! Please take the [tour] (you get a badge!), have a look around, and read through the [help], in particular [*How do I ask a good question?*](/help/how-to-ask), [*What types of questions should I avoid asking?*](/help/dont-ask)?, and [*What topics can I ask about here?*](/help/on-topic)? – Igor Jan 08 '19 at 10:54
1 Answers
This does not work well with the standard incoming webhook, since you will need to create a webhook for each user (as you stated).
Alternatively you can use the legacy version of the incoming webhook, which allows you to override the channel and which you can install from the app store. However, this is not recommended since its legacy: Sending message to different channel via slack webhook fails
However, the recommended approach is use the Web API method for sending messages to multiple channels / users: chat.postmessage
.
Note that there is no method for bulk sending direct messages to multiple or even all users. The standard approach to reach all users is to send a message in the announcement channel or by adding <!everyone>
to your message: Correct approach to DM many users using Web API
That message would be public though. If you really want to send a direct message to every user you can do so by iterating through the list of all users and send each of them a direct message via API methods: Slack Send Direct Message to ALL on SLACK

- 30,467
- 8
- 79
- 114