As per Slack documentation, incoming Webhooks are a simple way to post messages from apps into Slack. Creating an Incoming Webhook gives you a unique URL to which you send a JSON payload with the message text and some options. You can use all the usual formatting and layout blocks with incoming webhooks to make the messages stand out.
It takes only a few configuration items to start using the DevOps framework with Slack, like in this configuration file example.
Before using Slack with the InRule® DevOps framework, a Slack app has to be created and enabled for webhooks, following the steps at Incoming Webhooks for Slack.
- Create a new Slack app in the workspace where you want to post messages.
- From the Features page toggle Activate Incoming Webhooks on.
- Click Add New Webhook to Workspace.
- Pick a channel that the app will post to, then click Authorize.
- Use your Incoming Webhook URL to post a message to Slack.
Incoming webhooks are a simple way to post messages from external sources into Slack. They make use of normal HTTP requests with a JSON payload, which includes the message and a few other optional details. You can include message attachments to display richly-formatted messages.
Each time your app is installed, a new Webhook URL will be generated.
If you deactivate incoming webhooks, new webhook URLs will not be generated when your app is installed to your team. If you’d like to remove access to existing webhook URLs, you will need to Revoke All OAuth Tokens.
Once the Slack application is created, incoming webhooks enabled, and at least one webhook added to the application, we are ready to set up the configuration for where the DevOps framework can send Slack messages. The data sent to Slack by InRule DevOps can be "normal" notifications regarding various DevOps steps or detailed debug messages with the progress of an operation or any raised errors.
The webhook URL's are the only information the DevOps framework requires before it can start sending notifications to a Slack channel. The URL's must be listed separated by a space, under the Slack.SlackWebhookUrl configuration key. Here is an example, with masked values, which is applicable for a local deployment. For the DevOps app service, the configuration follows the format in the starter cloud config file.
<add key="Slack.SlackWebhookUrl" value="https://hooks.slack.com/services/xxxxxxxxx/xxxxxxxx/xxxxxxxxxxxxxxxxxxx https://hooks.slack.com/services/yyyyyyyyy/yyyyyyyy/yyyyyyyyyyyyyyyyyyy"/>
The "Slack." prefix makes the entry above the default Slack configuration used if no other ones are defined. If different channels or combinations of webhooks are needed to respond to specific needs, any number of uniquely identified Slack configurations can be added and referenced within the configuration.