For the complete documentation index, see llms.txt. This page is also available as Markdown.

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


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:

  1. In your pipeline, select Notify.

    Pipeline toolbar with the Notify control
  2. Select Notifications.

    The Notification Rule settings appear.

  3. Enter a name for the notification rule. You can edit the name after you select the events that trigger the rule.

  4. Select Next.

Select pipeline events

In Pipeline Events, select the events that trigger the notification.

Events behind a feature flag

The following events are behind feature flags. Contact Harness Support to enable them.

  • Trigger Failed: Feature flag PIPE_ENABLE_TRIGGER_FAILED_NOTIFICATION

  • Pipeline Resumed: Feature flag PIPE_PIPELINE_RESUME_NOTIFICATION

Pipeline Events list in a notification rule

You can select events for the pipeline or for stages.

If you select the stage events, you can select which stages to use.

Stage event selection in a notification rule

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.

Selecting specific steps for Step Failed notifications

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:

Email notification for a pipeline start event, including the start time, the person who started the pipeline, and a link to the execution

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:

Slack incoming webhook URL

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:

Slack Webhook URL field in the notification rule

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.

PagerDuty service Integrations tab with the integration key

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:

1

Open Workflows

In Microsoft Teams, right-click the channel name where you want to send notifications, and select Workflows.

Microsoft Teams channel menu with Workflows selected
2

Select the webhook workflow

In Workflows, select Post to a channel when webhook request is received.

Microsoft Teams workflow list with Post to a channel when webhook request is received
3

Name the webhook

Enter a name for the webhook, then click Next.

Webhook name field in Microsoft Teams
4

Select the team and channel

Select the Team and Channel where you want to receive notifications, then click Add Workflow.

Team and channel selection for a Microsoft Teams webhook
5

Copy the webhook URL

Microsoft Teams generates a webhook URL. Copy this URL to use in Harness.

Generated Microsoft Teams webhook URL

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:

  1. Click + Add Header to add a header.

  2. Click the Delete icon to delete a header.

  3. Set a header to a Fixed value or an Expression.

  4. Click Test to test the webhook integration.

Custom header key-value pairs on a webhook notification method

The following pipeline YAML shows a webhook notification method with custom headers:

Custom headers and Stage Start

You can include custom headers when you create webhook notification channels and when you update existing channels.

For a Stage Start event, such as a deployment stage, the notification summary includes unresolved expressions for services, infrastructure, and environments. This is intentional. The notification is sent before all references are fully resolved, so a resolution error does not fail the stage execution.

For example, a Slack notification when the pipeline completes, and another when it succeeds, looks something like this:

Slack notifications for pipeline completion and pipeline success

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.

Pipeline setting Mandate Authorization for Custom Webhook Triggers set to true

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.

Step and stage detail feature flag

Step and stage information in the Waiting For User Action and Pipeline Resumed events is behind the feature flag PIPE_STEP_INFO_IN_WAITING_AND_RESUME_NOTIFICATIONS. Contact Harness Support to enable this feature.

JSON example: Waiting For User Action

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:

JSON example: waitingSteps after a second step starts waiting

Step and stage detail feature flag

Step and stage information in the Waiting For User Action and Pipeline Resumed events is behind the feature flag PIPE_STEP_INFO_IN_WAITING_AND_RESUME_NOTIFICATIONS. Contact Harness Support to enable this feature.

JSON example: Pipeline Resumed

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.

Trigger Failed feature flag

The Trigger Failed event is behind the feature flag PIPE_ENABLE_TRIGGER_FAILED_NOTIFICATION. Contact Harness Support to enable this feature.


Datadog notifications

Datadog notifications feature flag

Datadog notifications are behind the feature flag PIPE_DATADOG_NOTIFICATIONS. Contact Harness Support to enable this feature.

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.com or your region-specific endpoint.

Configure Datadog notifications

Perform the following steps to configure the Datadog channel:

  1. Enter a name for the Datadog notification channel.

  2. Select the pipeline events you want.

  3. In Notification Method, select the channel type Datadog(/v1/events API).

    Channel type set to Datadog
  4. Enter the Datadog URL and API key. Enter the Datadog URL followed by /api/v1/events, for example https://app.datadoghq.com/api/v1/events/.

    Datadog URL and API key fields
  5. Optionally, add headers.

  6. 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.

Custom notification template selected on a notification rule

Select a connectivity mode

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

Connectivity mode options for a notification rule

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

Delegate selection for a pipeline notification rule

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

Delegate expressions feature flag

Expressions for delegate selection in pipeline notifications are behind the feature flag PIPE_SUPPORT_DELEGATE_EXPRESSIONS_FOR_PIPELINE_NOTIFICATIONS. Contact Harness Support to enable this feature.

Fixed Value and Expression options for the notification delegate

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

Expression must resolve

When a delegate is referenced with an expression, the expression must resolve to a valid delegate. If the expression does not resolve to a matching delegate, Harness does not send the notification.

Delegate Selection Expression List option

Delegate Selector sets individual delegate selectors as expressions.

Delegate Selector option with expression elements

Enable or disable notification rules

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

Notifications page with rules that can be enabled or disabled

Next steps

Last updated

Was this helpful?