Slack is a platform for team communication, offering instant messaging, document sharing, and knowledge search.
Following is a simple example of configuring Slack integration with cnMaestro Webhooks using a custom Template.
- On your Slack Screen, click on your workspace name at the top of the left-hand menu and open Administration > Manage apps.
- In the apps screen, click on the Build and then on the Start Building button.
- In the Create Slack App screen, enter an app name of your choice and select your Slack Workspace in the dropdown. Click Create App.
- In the Basic Information screen, select “Incoming Webhooks” from the left menu and create a webhook, providing all the permission and targeted Slack Channel details.
- From the above screen copy the Webhook URL, this needs to be used as URL in cnMaestro Webhook in the next steps.
- Login to cnMaestro and Navigate to Application >Settings >Webhooks.
- Click Add Webhook. Paste the URL from Slack and Expand Advanced Configuration.
Slack expects a custom JSON payload, The simple one is as follows
“text” : "<message>"
For this example, we are using the following custom template with variables $DEVICE_IP and $ALARM_SEVERITY in the formatted message.
"text" : "$DEVICE_IP has generated an alarm of severity
- Once an alarm occurs, the following message will appear in the configured Slack channel. Notice the variables have been replaced with actual values.
Learn more about Slack Webhook and expected JSON format at https://api.slack.com/incoming-webhooks .