Artisan IMG > Slack (slack) (6632c308-2cd1-4f68-8128-e521e552a66b)

Send Slack alert on workflow failure

Workflow
Universal
Beginner

This is a 'Workflow' template which means that it is a single standalone workflow.

Some workflow templates can be modified to work with other workflow templates - e.g. to convert a data sync between two services from uni-directional to bi-directional

Overview
Copy

Alerting workflows are useful for configuring error handling in your production workflows and solutions.

An Enabled Alerting workflow can be linked to:

  • Individual workflows in the same workspace or

  • At the user account level for all of their workflows.

See the Getting Live section for more information about how to apply this alerting workflow to your other workflows or account.

End Result
Copy

This alerting workflow makes use of the Slack connector to send a single alert message to a predefined channel or conversation. The message will come through like this:

The following will be presented to the members of the channel or conversation:

  • The title of the workflow that failed

  • A direct link to the error log itself

  • The workflow step which failed

  • The error message

Prerequisites
Copy

This workflow assumes the following:

  • Your team can authenticate to Slack

  • There is a channel or conversation in Slack that is suitable for alerting messages from one or more of your production Tray workflows. You can create a new channel just for this as needed, and invite all those who want to have alerting set up

  • You have pre-existing workflows in Tray.io that you wish to monitor with a workflow alert

Getting Live
Copy

To configure the workflow for your own use:

  1. Choose one of the following depending on how you wish to use the alerting template:

    • If it is only to be applied to a single user’s Personal Workspace, put this template in that user’s Workspace and Enable it. OR

    • If multiple users wish to use the same alerting workflow, or if Organization workflows should use it, promote the alerting workflow to the Organization workspace and Enable it.

  2. Create your own Slack authentication for the Slack connector, or use an existing one.

  3. Create or choose an existing Slack channel or conversation to pipe alerts into. Configure this in the Slack connector.

  4. Depending on whether you want to use the template at individual workflow level or account level:

    • Navigate to each workflow you would like to configure for alerting in your account. At the top left, click the Settings (three dots) button, then click Workflow Settings, then use the Alerting Workflow dropdown to find your alerting workflow:

    OR

    • Go to your profile settings and activate the alerting workflow to receive error messages for any errors across all workflows:

Workflow logic
Copy

As you can see from the following workflow screenshot:

This template only has two steps!

  1. The Alert trigger will be triggered any time one of your workflows errors.

  2. The Slack Send Alert Message can be configured to send exactly the information you need

Step-by-step breakdown
Copy

The following is a breakdown of exactly how the components of the Slack message are configured: