> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/use-continuous-delivery/cd-building-blocks/cd-steps/notify-users-of-pipeline-events.md).

# 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](https://developer.harness.io/docs/platform/role-based-access-control/add-user-groups) to configure notification preferences for a group.

***

## What you will learn from this topic

* How to [add a notification rule](#add-a-notification-rule) and [select pipeline events](#select-pipeline-events)
* How to scope a [Step Failed](#notify-on-specific-step-failures) notification to specific steps
* How to send the notification by [email](#email-notifications), [Slack](#slack-notifications), [PagerDuty](#pagerduty-notifications), [Microsoft Teams](#microsoft-teams-notifications), [webhook](#webhook-notifications), or [Datadog](#datadog-notifications)
* How to [notify Slack channels in user groups](#notify-slack-channels-in-user-groups), attach a [notification template](#notification-templates), [select a connectivity mode](#select-a-connectivity-mode), and [enable or disable the rule](#enable-or-disable-notification-rules)

***

## 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](https://developer.harness.io/docs/platform/role-based-access-control/add-user-groups) to add those preferences.

{% hint style="warning" %}
**Supported channels and runtime inputs**

Harness supports the communication and incident management platforms in this topic. If your platform is not listed, contact Harness.

Most **Notification Rule** settings, including the **Slack Webhook URL**, cannot be specified as runtime inputs. Provide the values before pipeline execution begins. You can use expressions. Check the input options in the **Notification Rule** settings to see which fields accept an expression.
{% endhint %}

***

## 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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-1cef65789b41d933b1da62734b9ca6e0c89bd54c%2Fnotify-users-of-pipeline-events-00.png?alt=media)
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 <a href="#select-events" id="select-events"></a>

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

{% hint style="info" %}
**Events behind a feature flag**

The following events are behind feature flags. Contact [Harness Support](mailto:support@harness.io) to enable them.

* **Trigger Failed**: Feature flag `PIPE_ENABLE_TRIGGER_FAILED_NOTIFICATION`
* **Pipeline Resumed**: Feature flag `PIPE_PIPELINE_RESUME_NOTIFICATION`
  {% endhint %}

![Pipeline Events list in a notification rule](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-9bb378bc9ba3221c441b452f148106ec48ca55cd%2Fnotification-strategy-list-of-all-events.png?alt=media)

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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-93e56acf9dd6c0c9ad0e6eff034be686367a455e%2Fnotify-users-of-pipeline-events-01.png?alt=media)

### 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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-fe77ee03510f83c7cc3f56c27967c478771e4817%2Fnotify-step-failed-select-steps.png?alt=media)

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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-78cb028f5f0a3f659b44739c44ccf087655c796d%2Fnotify-users-of-pipeline-events-02.png?alt=media)

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](https://api.slack.com/messaging/webhooks) to create the webhook.

When you are done, you have a webhook that looks something like this:

![Slack incoming webhook URL](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-70856351ad5e1f5e1e027ea2594b45badd5af388%2Fnotify-users-of-pipeline-events-03.png?alt=media)

Copy the webhook.

Paste the webhook into **Slack Webhook URL**, or add it as [encrypted text](https://developer.harness.io/docs/platform/secrets/add-use-text-secrets) in Harness and reference it here.

For example, if you have a text secret with the identifier `slackwebhookURL`, you can reference it like this:

```
<+secrets.getValue("slackwebhookURL")>
```

You can reference a secret in the Org scope with an expression that includes `org`:

```
<+secrets.getValue("org.your-secret-Id")>
```

You can reference a secret in the Account scope with an expression that includes `account`:

```
<+secrets.getValue("account.your-secret-Id")>
```

![Slack Webhook URL field in the notification rule](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-dee98be92e5cfd1ec58be8b3527e6d852d8d347d%2Fnotify-users-of-pipeline-events-04.png?alt=media)

***

## PagerDuty notifications

For PagerDuty notifications, enter the key for a PagerDuty account or service, or add it as [encrypted text](https://developer.harness.io/docs/platform/secrets/add-use-text-secrets) 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:

```
<+secrets.getValue("pagerdutykey")>
```

You can reference a secret in the Org scope with an expression that includes `org`:

```
<+secrets.getvalue("org.your-secret-Id")>
```

You can reference a secret in the Account scope with an expression that includes `account`:

```
<+secrets.getvalue("account.your-secret-Id")>
```

You can copy the key from PagerDuty **Configuration** -> **Services** -> **Service Details** -> **Integrations**, as shown below.

![PagerDuty service Integrations tab with the integration key](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-4cc77476a8ed958cd373b8089ff4cfd6ed7f1776%2Fnotify-users-of-pipeline-events-05.png?alt=media)

Go to PagerDuty's documentation on [creating integrations](https://support.pagerduty.com/docs/services-and-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:

{% stepper %}
{% step %}

### 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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-7a5d9f8ab5aa9b004e5748b076b99c065e741760%2Fnotify-users-of-pipeline-events-06.png?alt=media)
{% endstep %}

{% step %}

### 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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-b0fc2384c4ec54b915388520e25f5916137e59a2%2Fnotify-users-of-pipeline-events-07.png?alt=media)
{% endstep %}

{% step %}

### Name the webhook

Enter a name for the webhook, then click **Next**.

![Webhook name field in Microsoft Teams](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-66e9f96f721d27ca92f44b2e7185fd8a615a2758%2Fnotify-users-of-pipeline-events-08.png?alt=media)
{% endstep %}

{% step %}

### 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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-39b15ecff073cb08fe18aa8e223ffd3726dc680b%2Fnotify-users-of-pipeline-events-09.png?alt=media)
{% endstep %}

{% step %}

### Copy the webhook URL

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

![Generated Microsoft Teams webhook URL](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-38619d7fe51471a14b930f50d61f759001058e75%2Fnotify-users-of-pipeline-events-10.png?alt=media)
{% endstep %}
{% endstepper %}

### 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](https://developer.harness.io/docs/platform/secrets/add-use-text-secrets) and reference it here.

For example, if you have a text secret with the identifier `teamswebhookURL`, you can reference it like this:

```
<+secrets.getValue("teamswebhookURL")>
```

You can reference a secret in the Org scope with an expression that includes `org`:

```
<+secrets.getValue("org.teamswebhookURL")>
```

You can reference a secret in the Account scope with an expression that includes `account`:

```
<+secrets.getValue("account.teamswebhookURL")>
```

***

## 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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-89618a9c4eb46f74e7e2b1b795989a848e20ae74%2Fcustom_header.png?alt=media)

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

```yaml
notificationRules:
    - name: test
      identifier: test
      pipelineEvents:
        - type: AllEvents
        - type: PipelineStart
        - type: PipelineEnd
        - type: PipelineSuccess
        - type: PipelineFailed
        - type: StageFailed
        - type: StageSuccess
        - type: StageStart
        - type: StepFailed
        - type: TriggerFailed
        - type: WaitingForUserAction
        - type: PipelineResumed
      notificationMethod:
        type: Webhook
        spec:
          webhookUrl: https://app.harness.io/gateway/ng/api/projects/Quality_Assurence?accountIdentifier=ACCOUNT_ID&orgIdentifier=QE_Team
          headers:
            accept: "*/*"
            authorization: <+pipeline.variables.sv1>
            content-type: application/json
            Status: <+pipeline.status>
            Version: v1
            Content-Encoding: gzip
            Client-ID: <+pipeline.executionId>
            If-Match: xyz
      enabled: true
```

{% hint style="info" %}
**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.
{% endhint %}

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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-233c48b240c7e19ab071cc000de1ccbe2691ce30%2Fpipeline_notification_end_complete.png?alt=media)

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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-1ce2e0db1ef3053a8d89c7b2e18b300ce18a0850%2Fmandate_auth_custom.png?alt=media)

### JSON for webhook notifications

The following examples show the JSON body Harness sends for each event.

{% tabs %}
{% tab title="Pipeline Start" %}

```json
{
  "eventData": {
    "accountIdentifier": "ACCOUNT_ID",
    "orgIdentifier": "default",
    "projectIdentifier": "PROJECT_ID",
    "pipelineIdentifier": "PIPELINE_ID",
    "pipelineName": "PIPELINE_NAME",
    "planExecutionId": "PIPELINE_EXECUTION_ID",
    "executionUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/executions/PIPELINE_EXECUTION_ID/pipeline",
    "pipelineUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/pipeline-studio",
    "eventType": "PipelineStart",
    "nodeStatus": "started",
    "triggeredBy": {
      "triggerType": "MANUAL",
      "name": "NAME",
      "email": "EMAIL_ID"
    },
    "moduleInfo": {},
    "startTime": "Tue Aug 20 08:14:46 GMT 2024",
    "startTs": 1724141686
  }
}
```

{% endtab %}

{% tab title="Pipeline End" %}

```json
{
  "eventData": {
    "accountIdentifier": "ACCOUNT_ID",
    "orgIdentifier": "default",
    "projectIdentifier": "PROJECT_ID",
    "pipelineIdentifier": "PIPELINE_ID",
    "pipelineName": "PIPELINE_NAME",
    "planExecutionId": "PIPELINE_EXECUTION_ID",
    "executionUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/executions/PIPELINE_EXECUTION_ID/pipeline",
    "pipelineUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/pipeline-studio",
    "eventType": "PipelineEnd",
    "nodeStatus": "completed",
    "triggeredBy": {
      "triggerType": "MANUAL",
      "name": "NAME",
      "email": "EMAIL_ID"
    },
    "moduleInfo": {},
    "startTime": "Tue Aug 20 08:19:31 GMT 2024",
    "startTs": 1724141971,
    "endTime": "Tue Aug 20 08:19:42 GMT 2024",
    "endTs": 1724141982
  }
}
```

{% endtab %}

{% tab title="Pipeline Success" %}

```json
{
  "eventData": {
    "accountIdentifier": "ACCOUNT_ID",
    "orgIdentifier": "default",
    "projectIdentifier": "PROJECT_ID",
    "pipelineIdentifier": "PIPELINE_ID",
    "pipelineName": "PIPELINE_NAME",
    "planExecutionId": "PIPELINE_EXECUTION_ID",
    "executionUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/executions/PIPELINE_EXECUTION_ID/pipeline",
    "pipelineUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/pipeline-studio",
    "eventType": "PipelineSuccess",
    "nodeStatus": "completed",
    "triggeredBy": {
      "triggerType": "MANUAL",
      "name": "NAME",
      "email": "EMAIL_ID"
    },
    "moduleInfo": {},
    "startTime": "Tue Aug 20 08:22:42 GMT 2024",
    "startTs": 1724142162,
    "endTime": "Tue Aug 20 08:22:53 GMT 2024",
    "endTs": 1724142173
  }
}
```

{% endtab %}

{% tab title="Pipeline Failed" %}

```json
{
  "eventData": {
    "accountIdentifier": "ACCOUNT_ID",
    "orgIdentifier": "default",
    "projectIdentifier": "PROJECT_ID",
    "pipelineIdentifier": "PIPELINE_ID",
    "pipelineName": "PIPELINE_NAME",
    "planExecutionId": "PIPELINE_EXECUTION_ID",
    "executionUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/executions/PIPELINE_EXECUTION_ID/pipeline",
    "pipelineUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/pipeline-studio",
    "eventType": "PipelineFailed",
    "nodeStatus": "failed",
    "triggeredBy": {
      "triggerType": "MANUAL",
      "name": "NAME",
      "email": "EMAIL_ID"
    },
    "moduleInfo": {},
    "startTime": "Tue Aug 20 08:25:04 GMT 2024",
    "startTs": 1724142304,
    "endTime": "Tue Aug 20 08:25:18 GMT 2024",
    "errorMessage": "Shell Script execution failed. Please check execution logs.",
    "endTs": 1724142318
  }
}
```

{% endtab %}

{% tab title="Stage Failed" %}

```json
{
  "eventData": {
    "accountIdentifier": "ACCOUNT_ID",
    "orgIdentifier": "default",
    "projectIdentifier": "PROJECT_ID",
    "pipelineIdentifier": "PIPELINE_ID",
    "pipelineName": "PIPELINE_NAME",
    "planExecutionId": "PIPELINE_EXECUTION_ID",
    "stageIdentifier": "qq",
    "executionUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/executions/PIPELINE_EXECUTION_ID/pipeline",
    "pipelineUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/pipeline-studio",
    "stepName": "qq",
    "stageName": "qq",
    "eventType": "StageFailed",
    "nodeStatus": "failed",
    "triggeredBy": {
      "triggerType": "MANUAL",
      "name": "NAME",
      "email": "EMAIL_ID"
    },
    "startTime": "Tue Aug 20 08:28:13 GMT 2024",
    "startTs": 1724142493,
    "endTime": "Tue Aug 20 08:28:23 GMT 2024",
    "errorMessage": "Shell Script execution failed. Please check execution logs.",
    "endTs": 1724142503
  }
}
```

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.
{% endtab %}

{% tab title="Stage Success" %}

```json
{
  "eventData": {
    "accountIdentifier": "ACCOUNT_ID",
    "orgIdentifier": "default",
    "projectIdentifier": "PROJECT_NAME",
    "pipelineIdentifier": "PIPELINE_NAME",
    "pipelineName": "PIPELINE_NAME",
    "planExecutionId": "PIPELINE_EXECUTION_ID",
    "stageIdentifier": "qq",
    "executionUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/executions/PIPELINE_EXECUTION_ID/pipeline",
    "pipelineUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/pipeline-studio",
    "stepName": "qq",
    "stageName": "qq",
    "eventType": "StageSuccess",
    "nodeStatus": "completed",
    "triggeredBy": {
      "triggerType": "MANUAL",
      "name": "NAME",
      "email": "EMAIL_ID"
    },
    "startTime": "Tue Aug 20 08:38:40 GMT 2024",
    "startTs": 1724143120,
    "endTime": "Tue Aug 20 08:38:44 GMT 2024",
    "endTs": 1724143124
  }
}
```

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.
{% endtab %}

{% tab title="Stage Started" %}

```json
{
  "eventData": {
    "accountIdentifier": "ACCOUNT_ID",
    "orgIdentifier": "default",
    "projectIdentifier": "PROJECT_NAME",
    "pipelineIdentifier": "PIPELINE_NAME",
    "pipelineName": "PIPELINE_NAME",
    "planExecutionId": "DRWqd-imSA2wi8xPmoaOjQ",
    "stageIdentifier": "qs",
    "executionUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/executions/DRWqd-imSA2wi8xPmoaOjQ/pipeline",
    "pipelineUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/pipeline-studio",
    "stepName": "qs",
    "stageName": "qs",
    "eventType": "StageStart",
    "nodeStatus": "started",
    "triggeredBy": {
      "triggerType": "MANUAL",
      "name": "NAME",
      "email": "EMAIL_ID"
    },
    "moduleInfo": {},
    "startTime": "Tue Aug 20 09:03:09 GMT 2024",
    "startTs": 1724144589
  }
}
```

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.
{% endtab %}

{% tab title="Waiting For User Action" %}
{% hint style="info" %}
**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](mailto:support@harness.io) to enable this feature.
{% endhint %}

<details>

<summary>JSON example: Waiting For User Action</summary>

```json
{
  "eventData": {
    "accountIdentifier": "ACCOUNT_ID",
    "orgIdentifier": "default",
    "projectIdentifier": "PROJECT_ID",
    "pipelineIdentifier": "PIPELINE_ID",
    "pipelineName": "PIPELINE_NAME",
    "planExecutionId": "PIPELINE_EXECUTION_ID",
    "stageIdentifier": "gates",
    "stageName": "gates",
    "executionUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/executions/PIPELINE_EXECUTION_ID/pipeline",
    "pipelineUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/pipeline-studio",
    "eventType": "WaitingForUserAction",
    "nodeStatus": "waiting",
    "triggeredBy": {
      "triggerType": "MANUAL",
      "name": "NAME",
      "email": "EMAIL_ID"
    },
    "startTime": "Tue Aug 20 08:28:13 GMT 2024",
    "startTs": 1724142493,
    "waitingSteps": [
      {
        "identifier": "gateA",
        "name": "gateA",
        "fqn": "pipeline.stages.gates.spec.execution.steps.gateA",
        "type": "HarnessApproval",
        "status": "WAITING",
        "nodeExecutionId": "NODE_EXECUTION_ID_1",
        "startTs": 1724142493,
        "waitingSince": 1724142493
      }
    ],
    "waitingStepsUpdatedAt": 1724142493,
    "waitingStepsTruncated": false
  }
}
```

</details>

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:

<details>

<summary>JSON example: waitingSteps after a second step starts waiting</summary>

```json
"waitingSteps": [
  {
    "identifier": "gateA",
    "name": "gateA",
    "fqn": "pipeline.stages.gates.spec.execution.steps.gateA",
    "type": "HarnessApproval",
    "status": "WAITING",
    "nodeExecutionId": "NODE_EXECUTION_ID_1",
    "startTs": 1724142493,
    "waitingSince": 1724142493
  },
  {
    "identifier": "gateB",
    "name": "gateB",
    "fqn": "pipeline.stages.gates.spec.execution.steps.delayed_branch.gateB",
    "type": "HarnessApproval",
    "status": "WAITING",
    "nodeExecutionId": "NODE_EXECUTION_ID_2",
    "startTs": 1724142510,
    "waitingSince": 1724142510
  }
]
```

</details>
{% endtab %}

{% tab title="Pipeline Resumed" %}
{% hint style="info" %}
**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](mailto:support@harness.io) to enable this feature.
{% endhint %}

<details>

<summary>JSON example: Pipeline Resumed</summary>

```json
{
  "eventData": {
    "accountIdentifier": "ACCOUNT_ID",
    "orgIdentifier": "default",
    "projectIdentifier": "PROJECT_ID",
    "pipelineIdentifier": "PIPELINE_ID",
    "pipelineName": "PIPELINE_NAME",
    "planExecutionId": "PIPELINE_EXECUTION_ID",
    "executionUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/executions/PIPELINE_EXECUTION_ID/pipeline",
    "pipelineUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_NAME/pipelines/PIPELINE_NAME/pipeline-studio",
    "eventType": "PipelineResumed",
    "nodeStatus": "running",
    "triggeredBy": {
      "triggerType": "MANUAL",
      "name": "NAME",
      "email": "EMAIL_ID"
    },
    "startTime": "Tue Aug 20 08:30:02 GMT 2024",
    "startTs": 1724142602,
    "resumedStages": [
      {
        "stageExecutionId": "STAGE_EXECUTION_ID",
        "stageName": "gates",
        "stepsSummary": "gateA, gateB",
        "stepCount": 2
      }
    ],
    "resumedStepsCount": 2
  }
}
```

</details>

`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.
{% endtab %}

{% tab title="Trigger Failed" %}
{% hint style="info" %}
**Trigger Failed feature flag**

The **Trigger Failed** event is behind the feature flag `PIPE_ENABLE_TRIGGER_FAILED_NOTIFICATION`. Contact [Harness Support](mailto:support@harness.io) to enable this feature.
{% endhint %}

```json
{
  "eventData": {
    "accountIdentifier": "ACCOUNT_ID",
    "orgIdentifier": "default",
    "projectIdentifier": "PROJECT_ID",
    "pipelineIdentifier": "PIPELINE_ID",
    "pipelineName": "PIPELINE_NAME",
    "pipelineUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_ID/pipelines/PIPELINE_ID/pipeline-studio/",
    "triggerActivityUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_ID/pipelines/PIPELINE_ID/triggers/TRIGGER_ID/activity-history/",
    "triggerUrl": "https://app.harness.io/ng/#/account/ACCOUNT_ID/cd/orgs/default/projects/PROJECT_ID/pipelines/PIPELINE_ID/triggers/TRIGGER_ID/detail/",
    "triggerName": "TRIGGER_NAME",
    "triggerIdentifier": "TRIGGER_ID",
    "triggerType": "Webhook",
    "triggerSubType": "CUSTOM",
    "eventType": "TriggerFailed",
    "startTime": "Wed Aug 20 13:21:11 GMT 2025",
    "startTs": 1755868871597,
    "errorMessage": "Failed while requesting Pipeline Execution through Trigger: Stage executions are not allowed for pipeline [PIPELINE_ID]"
  }
}
```

{% endtab %}
{% endtabs %}

***

## Datadog notifications

{% hint style="info" %}
**Datadog notifications feature flag**

Datadog notifications are behind the feature flag `PIPE_DATADOG_NOTIFICATIONS`. Contact [Harness Support](mailto:support@harness.io) to enable this feature.
{% endhint %}

Datadog notifications send pipeline event notifications to your Datadog monitoring system with the [Events API (v1)](https://docs.datadoghq.com/api/latest/events/).

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](https://app.datadoghq.com/organization-settings/api-keys).
* **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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-d3cbd852fcb2a1520540dbce7efd76be32bd43e0%2Fdatadog-notification-1.png?alt=media)
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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-e607b84159974e90b86ee23795200f1374dd0910%2Fdatadog-api-conf.png?alt=media)
5. Optionally, add headers.
6. Test the channel, then complete the setup.

Go to Datadog's documentation on the [Events API (v1)](https://docs.datadoghq.com/api/latest/events/) 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](https://developer.harness.io/docs/platform/notifications/notifications/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](https://developer.harness.io/docs/platform/templates/customized-notification-template).

![Custom notification template selected on a notification rule](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-b1fddbe3fb0deb370a22f874de021a54b0bec136%2Fcustom-notification.png?alt=media)

***

## 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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-ebce25b6bde9855bd9c169bb521bd786b581ab64%2Fdelegate-routing-support.png?alt=media)

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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-ce50a4f353cfe166e0a4f0032abcb3654996c216%2Fpipeline-notification-delegates-setup.png?alt=media)

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

{% hint style="info" %}
**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](mailto:support@harness.io) to enable this feature.
{% endhint %}

![Fixed Value and Expression options for the notification delegate](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-3e89ee15c9d3fb40921a26a324897701d02cef1b%2Fpipeline-notification-delegates-expressions.png?alt=media)

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

{% hint style="info" %}
**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.
{% endhint %}

![Delegate Selection Expression List option](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-1e20c66ce4e7ed7964b3ff46133b48d225a9e5c4%2Fpipeline-notifications-delegate-expressions-selection-expression-list.png?alt=media)

**Delegate Selector** sets individual delegate selectors as expressions.

![Delegate Selector option with expression elements](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-b0c0a6ba71874c3c99f19879a77a9fbeb8112a60%2Fpipeline-notifications-delegate-expressions-selector.png?alt=media)

***

## 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](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-ac143d0033f3db0d40d5bfb3f7ecbb760fca5147%2Fnotify-users-of-pipeline-events-11.png?alt=media)

***

## Next steps

* [Manage user groups](https://developer.harness.io/docs/platform/role-based-access-control/add-user-groups): Set notification preferences for a group, including a Slack webhook.
* [Add encrypted text](https://developer.harness.io/docs/platform/secrets/add-use-text-secrets): Store a webhook URL or PagerDuty key as a secret and reference it from the rule.
* [Send notifications using Slack](https://developer.harness.io/docs/platform/notifications/notifications/send-notifications-using-slack): Add a Slack incoming webhook to a user group.
* [Custom notification templates](https://developer.harness.io/docs/platform/templates/customized-notification-template): Replace the default notification content with a template.

{% @harness-feedback/feedback %}
