Skip to content

Slack Conditionals

Conditional Processing or Execution Conditions gives you the power to decide if a particular action on Slack will be performed or not when the workflow is triggered by the incoming event. This is akin to the ability to apply 'if-then-else' logic to the execution of an action based on the value of the attribute from the trigger event of the workflow.

Think of Conditional Processing as an equivalent of 'if-then-else', as decision diamond in the flow chart, or the Conditional Branching in BPEL (Business Process Execution Language).

You can add Conditional Processing to any action in your workflow and decide which actions should be performed in response to a particular trigger event identified by its characteristics or the data attributes. You can apply complex logic using AND, OR, and grouping of such conditions. Each of the conditions supports different operators based on the event data types like a string, number, boolean, etc. Read here to find out more about Conditional Processing.

Example Scenario

To better illustrate event filters, we will take a scenario where you are using a Slack channel for your employees to send service help requests when they are experiencing a service outage. When a request is posted to this channel, a ServiceNow Action is then performed to create an incident based on the execution conditions. There could be multiple application actions attached to be invoked upon receiving a request for help. Each of the actions in the flow would apply its own execution condition based on the data attributes of the help request in the help channel. This will allow each of the actions to independently choose to execute based on the defined execution conditions.

When you use Slack as a trigger application, the following attributes will be available to you when you are configuring your application action:

  • Team ID - The unique identifier for the workspace/team
    On Slack, every team has a name and unique ID for their workspace.
  • User - The name of the user who posted on the channel
  • Event Text - The message that was sent to the channel
  • Channel - Channel ID Example: C061F7AUR
    In Slack, all communication happens in channels. You can learn more about Slack channels here.
  • Event Time - The timestamp the message was posted to the channel in Epoch time

In Figure 1, the action of creating an incident in ServiceNow will only be performed if the message is received on the "service-needs" Slack Channel or slack message contains the phrase "Critical".

Conditional Processing in Connect iPaaS

Figure 1. Conditional Processing in Connect iPaaS

Similarly in Figure 2, in the same workflow, an SMS will be sent using Twilio if the Slack message contains "Critical" or "Urgent"

Conditional Processing in Connect iPaaS

Figure 2. Conditional Processing in Connect iPaaS