Route Slack messages based on random number selection

Recipe ToolsDeveloper ToolMarketingCollaborationSales Enablement

What it does

When a new call arrives for SendGmail, this automation generates a random number. Based on that number, it posts a message to Slack so someone sees which routing path was taken.

Who it's for

Operations teams who need to distribute messages to Slack channels based on random routing logic.

How teams use this

Distribute messages across Slack channels

Route incoming calls to different Slack channels randomly so messages are spread across team conversations. This keeps any single channel from becoming overloaded with notifications.

Load-balance alerts to on-call teams

Send alerts to different Slack channels based on random selection so on-call rotations share the load evenly. Only the message content and channel targets change.

Add weighted routing by team priority

Modify the random number logic to check team priority levels so critical messages always route to the primary channel. Set conditions that filter based on message importance before routing.

How it works

  1. Receive a new SendGmail call. A real-time call arrives for SendGmail in Workato Service, starting this automation and passing data downstream.
  2. Generate a random number. Execute JavaScript code in Js Eval to generate a random number between 1 and 3 that determines which Slack message path runs next.
  3. Post message to Slack. Post a message in Slack based on the random number result. The channel sees which routing path was taken by this automation.