Want to get started building a Slack app, but not sure what you need? The Slack API provides three easy ways to programmatically post messages.
There are three easy scenarios:
Posting messages in a specific channel (say #engineering).
If you know what channel you want to post to, you can set up an incoming webhook. (An example of this would be wanting to share reviews from an AppStore in your #engineering channel). You'll be able to post at any point, and everyone in the channel will see it.
Responding privately to a specific user.
If you want to post something for a user on demand, the best way is to set up a /command. When the user calls it, regardless of channel, you'll receive a response_url parameter and can publish back to them. (For example, letting users ask a Magic Eight Ball). They'll be able to use this from any channel.
For anything other than these two scenarios, use the chat.postMessage (make sure you have a write scope defined in the OAuth/Permissions section). This will allow your app to publish to any channel, for all users to see!
In any of these cases, if you need fancier messages, the Slack Block Kit Builder lets you write/get real JSON, while also being able to see what your message would look like. You should be able to try these methods out wherever your favorite place is to set up an API!
Want to get started without a bunch of other set up? Join the Dark Beta and mention dev.to.
This is all you need to do to get these three options going in Dark:
Latest comments (0)