Overview

Use conditional templating to change messages, set notification handles, or override alert priority based on test results. This is especially useful when routing alerts to specific teams.

To ensure notifications are delivered properly, always include a notification handle in your conditional logic. Notifications are dropped if no handle is provided. Make sure to:

  • Include a catch-all condition using {{else}} to handle any unmatched scenarios.
  • Provide notification handles for both alert and recovery notifications.

For more detailed information, see the Monitor documentation.

Examples

Send alerts to a specific Slack channel based on failed step:

{{#is_match "synthetics.failed_step.description" "Checkout"}}
@notify-slack-payments
{{/is_match}}

Send alerts based on status code:

{{#is_exact_match "synthetics.attributes.result.response.statusCode" "500"}}
@notify-slack-backend
{{/is_exact_match}}

Set different alert priorities:

{{#if synthetics.failed_step.name}}
{{override_priority "P2"}}
{{else}}
{{override_priority "P4"}}
{{/if}}

Further Reading