How to set up drift detection notifications in Slack

Last updated: December 19, 2025

Spacelift can automatically detect drift in your stacks and send notifications to external channels like Slack when changes are detected.

Setting up drift detection notifications

To receive drift detection notifications outside of the Spacelift UI, you'll need to:

Configure a notification policy - Use a notification policy that triggers when drift is detected. Spacelift provides an example policy that sends notifications to Slack when there's at least one change detected:

Drift detection notification policy example

package spacelift
# This import is required for Rego v0 compatibility and can be removed if you are only using Rego v1.
import rego.v1
slack contains {"channel_id": "C000000"} if {
# Checking if drift detection is present in the run update
input.run_updated.run.drift_detection
# Condition to verify that there is at least one change
count(input.run_updated.run.changes) > 0
}
sample := true
  1. Set up drift scheduler - Configure automatic drift detection to run on a schedule. Note that this feature requires a private worker.

    Learn more about drift detection setup

Requirements

Setting up scheduled drift detection requires a private worker to be configured for your stack.

Once configured, Spacelift will automatically run drift detection according to your schedule and send notifications to your specified Slack channel whenever changes are detected in your infrastructure.