In this Article
In any enterprise ecosystem, receiving notifications is critical to carry out your daily tasks. Emails are no longer the preferred method of receiving notifications, especially when the notifications involve time-critical issues. To fasten the decision-making process and deliver results, you can configure an Event Listener in the Slack workspace to cut through the clutter and get notified on items that need immediate attention. This use case demonstrates how you can use the Slack Snap Pack to route important events into a custom channel created for this purpose.
In a real business case scenario, going through all messages posted on the Slack is time-consuming. However, you cannot miss out on important updates that require attention.
Using Slack integration for your organization allows you to set up notifications to send messages to a private channel or a specific user on Slack. You can efficiently automate the process of listening to Slack events, configuring the events, and receiving alerts on your Slack Channel upon the trigger of events. This pipeline demonstrates how you can automate the same.
Parent Pipeline - Slack Listener | Child Pipeline - Process Event |
---|---|
Download the Slack Listener and Process Events Pipelines.
Prerequisites:
Key steps:
Create a private (custom) channel named #my_alerts. and add the necessary stakeholders who must receive alerts for the given events.
Configure two events to receive alerts on the private channel when the following events occur:
To subscribe events in Slack:
First, we configure the Mapper Snap with an expression to determine if the object is a challenge or an event.
This expression includes three elements: Token, Challenge and Type.
|
Create a a triggered task for the Parent pipeline. From the Triggered task dialog window, we copy the Cloud URL and HTTP Header (token) and paste it in Request URL field in the Slack app for verification.
You must append the bearer token to the URL. |
Once the Slack app receives the challenge from the Parent Pipeline, the URL is verified. After the URL is verified which usually takes three seconds, the request triggers the Parent Pipeline and it receives the challenge as response.
The Redirect URL should correspond to the same URL used for event subscription for the Slack app to function with the Slack Snap Pack. |
Now we continue with the Parent Pipeline configuration to listen to the Slack events and process the events as per the requirement.
We configure the Router Snap with expressions that evaluate whether the input view contains a challenge or an event and routes the outputs appropriately.
If the input is a challenge, the Pipeline processes and sends the response. If the input is an event, the Router Snap routes the output to the Pipeline Execute Snap that runs the child Pipeline to process the event in the Process_Event Pipeline.
Next, we use the Join Snap to join both the output views of Pipeline Execute and Mapper Snaps using left outer join to get a unified output.
We configure the child Pipeline to perform the following two operations:
Event 2: When a user posts a SWAT message in the channel.
You can configure the Pipeline to process more events based on your need. |
First, we configure the Router Snap to determine the type of event, whether it is a new member joining the channel (event 1) or a message posted in the channel (event 2).
If it is a message event, we want to check if the message contains the key word SWAT. Hence, we configure the Filter Snap as follows:
If the message contains SWAT, we intend to send the alert to the #my_alerts channel. So, we configure the Send Channel Message Snap with relevant Slack message as follows:
On running the Pipeline, the relevant SWAT message is sent to #my_alerts channel as follows:
If the event is a new member joining the channel we take this approach. We take a copy of the output from the Router Snap to extract user and channel information when a member joins a channel, and configure the following Snaps:
User Operations Snap | Channel Operations Snap |
---|---|
We configure the Mapper Snap to extract the name of the user and map it to the channel.
Next, we join the inputs from the Slack User Operations and Channel Operations Snaps using the Outer join of Join Snap to get an user alert.
We configure the Slack Send Message Snap to send alerts to #my_alerts channel.
On running the Pipeline, the relevant new user alert is sent to #my_alerts channel as follows:
Finally, we configure the Join Snap to get a single output from the two output views. This output is the output of the Pipeline Execute Snap in the Parent Pipeline.
Important steps to successfully reuse Pipelines
|