# Configuring alerts in Insights

You can configure alerts for:

- Builds
- Tests
- Credit usage

For each category, you can set alerts for any of the available metrics: [Bitrise CI metrics](/insights/available-metrics-in-insights/bitrise-ci-metrics).

For each alert, you have to choose how to receive the notification. There are three options:

- Microsoft Teams: The alert will post a notification to a Teams channel of your choice. [You need to configure incoming webhooks in Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=dotnet).
- Slack: The alert will post a notification to a Slack channel of your choice. You need [a Slack app with incoming webhooks enabled](https://api.slack.com/messaging/webhooks).
- Email: The alert will notify you via email.

## Creating a new alert

You can create a new alert at any time in Insights:

1. Open Insights for your project.
1. Go to the **Create alert** page. To do so, you have two options:

   - Select **Alerts** from the left menu and click on **Create alert**.

     ![create-alert-button.png](/img/_paligo/uuid-6df6ae6a-869d-58a9-dbea-2fa93fba24e2.png)
   - Click on the bell icon above any metric in **Builds**, **Tests**, or **Credits**.

     ![bell.png](/img/_paligo/uuid-d7b270fb-8c64-ce2d-c083-c1dbcfdde87f.png)
1. Choose a metric type and a specific metric within that type in the **Metric type** section.

   ![metric-type.png](/img/_paligo/uuid-3cab36a0-7c43-5fb3-40cb-d7c03cd8ab00.png)
1. In the **Filters** section, select a project then click **Add filter** to add filter conditions. If you don't select a project, the alert will apply to every project in the workspace, without filters.

   You can create filters for a specific [Pipeline](/bitrise-ci/workflows-and-pipelines/build-pipelines/pipelines-with-stages/configuring-a-pipeline-with-stages), a Workflow, or even a Step. You can also filter for branches, [stacks](/bitrise-build-hub/infrastructure/build-stacks/about-build-stacks), and [machine types](/bitrise-platform/infrastructure/build-machines/about-build-machines).

   ![alert-filters.png](/img/_paligo/uuid-918b42a8-4b92-3f05-5514-1b137c85e283.png)
1. In the **Conditions** section, set up the alert conditions.

   - **Direction**: Choose whether to create an alert when a given threshold is above, equal, or below a certain limit.
   - **Threshold**: The value the direction applies to. The exact nature of it depends on the metric you chose: for example, if you chose credit usage, you can set an amount of credits consumed to trigger an alert.
   - **Monitored window**: The time period that the alert monitors.
1. In the **Notifications** section, name the alert in the **Alert name** field.
1. In the **Notification providers** section, click **Add new** and choose between three notification providers from the dropdown menu:

   - **Slack**: Create an incoming webhook that posts into a selected channel and paste the webhook URL. To do so, you need to create a Slack app and enable incoming webhooks in the app: [Sending messages using incoming webhooks](https://api.slack.com/messaging/webhooks).
   - **Teams**: Create an incoming webhook for a selected Teams channel and paste the webhook URL: [Create incoming webhooks for Teams](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=dotnet).
   - **Email**: Set a valid email address. The alert will send a notification to the address.
1. When you're ready, click **Create** to finish the alert.

## Editing an existing alert

Once an alert is in place in Insights, you can modify it at any time from the **Alerts** page. You can change the threshold, the granularity (the time period the alert applies to), or modify the notification providers.

:::important[Metric type can't be changed]

You can't modify the metric type that the alert monitors. For example, if the alert is monitoring build failure rate, you can't change it to monitor credit usage instead. Similarly, you can't change the filtering: if you were monitoring a specific app, you can't change the alert to monitor a different app instead.

If you need a similar alert for a different metric or with a different filter, duplicate the existing alert: [Duplicating an existing alert](/insights/configuring-alerts-in-insights#duplicating-an-existing-alert).

:::

To edit an alert:

1. Open Insights for your app.
1. On the left, select **Alerts**.

   ![alerts.png](/img/_paligo/uuid-3c75e562-bf1f-266f-ec68-910589ed408e.png)
1. Select the alert you need and on the right, click the **View alert** button.

   ![existing-alert.png](/img/_paligo/uuid-387f919f-49c9-14ae-cb62-1bc4f47cda1e.png)
1. On the alert's page, click the ellipsis in the top right corner to open the context menu.

   ![edit-alert.png](/img/_paligo/uuid-a493c03e-ab64-9b02-748d-556fdd1c1b1a.png)
1. Select **Edit alert**.
1. Modify the threshold, the granularity, or the notification provider.
1. Click **Save**.

## Duplicating an existing alert

You can duplicate any existing alert and then modify it during the alert creation process. This allows users to quickly create new alerts based on existing ones.

To duplicate an alert:

1. Open Insights for your app.
1. On the left, select **Alerts**.

   ![alerts.png](/img/_paligo/uuid-3c75e562-bf1f-266f-ec68-910589ed408e.png)
1. Select the alert you need and on the right, click the **View alert** button.

   ![existing-alert.png](/img/_paligo/uuid-387f919f-49c9-14ae-cb62-1bc4f47cda1e.png)
1. On the alert's page, click the ellipsis in the top right corner to open the context menu.

   ![edit-alert.png](/img/_paligo/uuid-a493c03e-ab64-9b02-748d-556fdd1c1b1a.png)
1. Select **Duplicate**.
1. The duplicate feature takes you [to the **Create alert** page](/insights/configuring-alerts-in-insights#creating-a-new-alert), with the existing alerts values already set. Make your changes and then click **Create** at the bottom of the page.
