...
We will want to create a new Messaging Account for Slack. We can do this by going to Topology→ Configuration→ Integrations → Messaging. For the Slack provider, the only required property is the Bot Bearer Token.
...
Creating an Outgoing Webhook Listener
Now that Slack is integrated with FlexDeploy we will now want to create the Webhook Listener that will process all failed Workflow Completed events. To do this we will navigate to the events screen through Administration → Integrations → Outgoing Webhooks and then click the Configuration button in the top right corner. To create a new Webhook Listener click the Create Listener button.
...
Info |
---|
The below script is posting the initial message to slack and subsequently replying to that message with the plugin logs. If you only wish to send the initial message you can stop after line 15 |
...
...
Full Screen display of the script
...
Expand | |||||
---|---|---|---|---|---|
| |||||
|
As stated before you will need to add your Slack account prior to using this listener.
...
We now have a Webhook Listener that will send a Slack notification to our specified channel every time a workflow is completed. In order to only send the notification when the workflow execution has failed we will need to implement a filter. The filter is groovy script that will determine whether or not our Listener will process a given event. To edit the filter we will need to click the filter tab to the left of our script tab. We will now create a groovy script that will return true when we want our listener to process the event and false otherwise.
...
...
Full Screen display of the filter script
...
Expand | |||||
---|---|---|---|---|---|
| |||||
|
...
Now that we have our Webhook Listener completely set up we will create a workflow that will fail and attempt to execute it. In order to see if our filter is working correctly we will view our event messages after executing our faulty workflow. This can be found by clicking the Outgoing Webhook Messages button on the main events listeners page.
...
Clicking on the Message row will allow us to see more information about the logs and payload
...
On this page we should be able to see our event has been processed by our new listener in the table along with the payload that was sent. Our message states that our Slack message has been sent so we can verify that. If the message has not been sent we can debug by showing our groovy logs by clicking the show logs button and resubmit the event with the same payload by clicking the resubmit button. These tool are very useful for debugging as we can create a duplicate event without having to go back and execute our workflow.
...