Add a pipeline notification strategy
Send pipeline event notifications by email, Slack, PagerDuty, Microsoft Teams, webhook, or Datadog.
You can notify recipients when pipeline events occur. Harness sends the event information by email or through Slack, PagerDuty, Microsoft Teams, a webhook, or Datadog.
You set up event notifications with Notification Rules on the pipeline. Select the events to send, then select how to send them. When those events occur, Harness sends the event information to the channels and recipients you configured.
You can also set notification preferences on user groups. Go to Manage user groups to configure notification preferences for a group.
What you will learn from this topic
How to add a notification rule and select pipeline events
How to scope a Step Failed notification to specific steps
Before you begin
Confirm the following before you create a notification rule:
Pipeline permission: You must belong to a user group with a role that has the pipeline Create/Edit permission.
User group preferences (optional): To notify a group's Slack channel from the rule, set notification preferences on the user group. Go to Manage user groups to add those preferences.
Add a notification rule
Perform the following steps to add a notification rule:
In your pipeline, select Notify.

Pipeline toolbar with the Notify control Select Notifications.
The Notification Rule settings appear.
Enter a name for the notification rule. You can edit the name after you select the events that trigger the rule.
Select Next.
Select pipeline events
In Pipeline Events, select the events that trigger the notification.

You can select events for the pipeline or for stages.
If you select the stage events, you can select which stages to use.

Notify on specific step failures
When you select the Step Failed event, you can scope the notification to specific steps rather than every step failure in the pipeline. After you select Step Failed, use the Select Steps dropdown to choose the steps you want to monitor.
Use this when you care about failures in critical steps, such as a deployment or approval step, and you want to avoid noise from other step failures.

If no specific steps are selected, the notification fires on any step failure in the pipeline. That is the default behavior.
Select Continue.
The next step is the notification channel. The channel settings are described in the sections below.
A few events need extra care:
If you select both Pipeline End and Pipeline Success, you receive two notifications.
Pipeline Pause applies only to a manual pause of the pipeline execution. Pending approval steps do not trigger the pipeline pause event.
Waiting for User Action fires when the pipeline enters a waiting state because it needs user input. This includes Approval steps, Manual Intervention steps, and runtime execution inputs. The notification is sent at the pipeline level and cannot be scoped to a specific step type or stage. This event is different from Pipeline Pause, which triggers only on a manual pause of the execution.
Email notifications
For email notifications, enter the email addresses you want to notify.
Enter multiple addresses as a comma-separated list. For example, john.doe@example.io,qateam@example.io.
The following example is an email notification for the pipeline Start event:

Along with the start date and who triggered the pipeline, the email includes a link to the pipeline execution in Harness.
Slack notifications
For Slack notifications, create a webhook in Slack and paste it into Slack Webhook URL in the notification rule.
Follow the steps in the Slack documentation for creating a Slack app, selecting your channel, and creating a webhook. Go to sending messages using incoming webhooks to create the webhook.
When you are done, you have a webhook that looks something like this:

Copy the webhook.
Paste the webhook into Slack Webhook URL, or add it as encrypted text in Harness and reference it here.
For example, if you have a text secret with the identifier slackwebhookURL, you can reference it like this:
You can reference a secret in the Org scope with an expression that includes org:
You can reference a secret in the Account scope with an expression that includes account:

PagerDuty notifications
For PagerDuty notifications, enter the key for a PagerDuty account or service, or add it as encrypted text in Harness and reference it in PagerDuty Key. Harness sends notifications with this key.
For example, if you have a text secret with the identifier pagerdutykey, you can reference it like this:
You can reference a secret in the Org scope with an expression that includes org:
You can reference a secret in the Account scope with an expression that includes account:
You can copy the key from PagerDuty Configuration -> Services -> Service Details -> Integrations, as shown below.

Go to PagerDuty's documentation on creating integrations to create the integration.
Microsoft Teams notifications
To set up notifications in Microsoft Teams, you need a webhook URL for the channel that receives the notifications.
Create a webhook in Microsoft Teams
Perform the following steps to create the webhook in Microsoft Teams:
Use the webhook URL in Harness
In Notification Method, enter the webhook URL for your Microsoft Teams channel in Microsoft Teams Webhook URL, or add it as encrypted text and reference it here.
For example, if you have a text secret with the identifier teamswebhookURL, you can reference it like this:
You can reference a secret in the Org scope with an expression that includes org:
You can reference a secret in the Account scope with an expression that includes account:
Webhook notifications
Use webhook notifications to inform an external application of an event.
Select the webhook notification method. Enter the URL that Harness calls when the event occurs.
You can use expressions to compose this URL. For example, https://companyurl.notify.com/execution=-<+pipeline.executionId>.
The expression must be evaluated in the context of the event. For example, stage-related expressions may not be valid for pipeline start events.
Add custom headers
The webhook notification method can include custom headers. Each header is a key-value pair.
When you add custom headers, you can do the following:
Click + Add Header to add a header.
Click the Delete icon to delete a header.
Set a header to a Fixed value or an Expression.
Click Test to test the webhook integration.

The following pipeline YAML shows a webhook notification method with custom headers:
For example, a Slack notification when the pipeline completes, and another when it succeeds, looks something like this:

Harness sends the webhook as a POST request. The body is a JSON object with the properties of the triggered event.
If you use a custom webhook trigger in the webhook notification method, and the pipeline setting Mandate Authorization for Custom Webhook Triggers is true, pass the API key in the header.

JSON for webhook notifications
The following examples show the JSON body Harness sends for each event.
The JSON above is for one stage. If you select all stages, the webhook is triggered three times. In this example, the pipeline has two stages, qq and qs. Both failed, and the notification was triggered twice.
The JSON above is for one stage. If you select all stages, the webhook is triggered three times. In this example, the pipeline has two stages, qq and qs. Both succeeded, and the notification was triggered twice.
The JSON above is for one stage. If you select all stages, the webhook is triggered three times. In this example, the pipeline has two stages, qq and qs. Both stages started, so the notification was triggered twice.
The waitingSteps array lists every step in the stage that is currently in the WaitingForUserAction state, with its identifier, name, fully qualified name (fqn), type, status, node execution ID, start time, and the time it started waiting. The fqn reflects the step's position in the stage, including any parallel or conditional branch it belongs to, so you can distinguish two steps with the same name in different branches.
waitingStepsUpdatedAt is the timestamp of the most recent change to waitingSteps. waitingStepsTruncated is true if the stage has more waiting steps than the array can hold, so you know the list is not exhaustive.
If gate A enters WaitingForUserAction, Harness sends a WaitingForUserAction notification for the stage. If gate B also enters WaitingForUserAction while gate A is still waiting, Harness does not send a separate notification for gate B alone. It sends another WaitingForUserAction notification for the same stage, with waitingSteps updated to list both steps. Every WaitingForUserAction notification for a stage contains the full set of steps currently waiting, never a single step on its own:
PipelineResumed fires when every step that was waiting in a stage has resumed, so the stage as a whole moves out of WaitingForUserAction. The resumedStages array lists each stage that resumed, with its stage execution ID, name, a summary of the steps that were waiting, and the count of those steps. resumedStepsCount is the total step count across all resumed stages in the event.
Harness cannot attribute a resume to a single step, because a step resumes concurrently with any other steps still running in the same stage. If a stage has multiple steps waiting and only one is approved, the stage itself remains waiting, so no PipelineResumed notification is sent until every waiting step in the stage has resumed.
Datadog notifications
Datadog notifications send pipeline event notifications to your Datadog monitoring system with the Events API (v1).
This integration keeps pipeline updates in your existing monitoring workflows.
Datadog prerequisites
You need the following before you configure the Datadog channel:
API key: Generate an API key in Datadog. Go to Profile -> Organization Settings -> API Keys, or open the API Keys page.
Datadog URL: The Datadog instance URL for your account, for example
https://app.datadoghq.comor your region-specific endpoint.
Configure Datadog notifications
Perform the following steps to configure the Datadog channel:
Enter a name for the Datadog notification channel.
Select the pipeline events you want.
In Notification Method, select the channel type Datadog(/v1/events API).

Channel type set to Datadog Enter the Datadog URL and API key. Enter the Datadog URL followed by
/api/v1/events, for examplehttps://app.datadoghq.com/api/v1/events/.
Datadog URL and API key fields Optionally, add headers.
Test the channel, then complete the setup.
Go to Datadog's documentation on the Events API (v1) for the request format.
Notify Slack channels in user groups
If Harness user groups have Slack webhooks in their Notification Preferences, you can select those groups. Harness notifies them in addition to the email, Slack, or PagerDuty settings on the rule.
Go to send notifications using Slack to add a Slack webhook to a user group.
Notification templates
You can customize the notification with a custom notification template.

Select a connectivity mode
Under Select the Connectivity Mode, choose Connect through Harness Platform or Connect through Harness Delegate.

When you select Connect through Harness Delegate and click Continue, select the delegate this notification rule uses in Delegate Setup.

You can set the delegates as a Fixed Value or an Expression.

Delegate Selection Expression List sets the list of delegate selectors as an expression.

Delegate Selector sets individual delegate selectors as expressions.

Enable or disable notification rules
After you create notification rules, you can enable and disable them on the Notifications page.

Next steps
Manage user groups: Set notification preferences for a group, including a Slack webhook.
Add encrypted text: Store a webhook URL or PagerDuty key as a secret and reference it from the rule.
Send notifications using Slack: Add a Slack incoming webhook to a user group.
Custom notification templates: Replace the default notification content with a template.
Last updated
Was this helpful?




