> For the complete documentation index, see [llms.txt](https://docs.lenses.io/latest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lenses.io/latest/user-guide/using/alerting-and-monitoring/alert-integration.md).

# Alert Integration

## Alert connections

Alert connections define where an agent can send alerts. Configure connections in the [provisioning file](https://docs.lenses.io/latest/deployment/configuration/agent/automation).

Lenses supports AWS CloudWatch, Datadog, PagerDuty, Prometheus Alertmanager, Slack, and webhooks.

To configure a connection:

1. Select **Environments & Topics**.
2. Expand the environment, then select **Configuration**.
3. Edit, test, and apply the provisioning file to the connected agent.

## Alert channels

After configuring a connection, create alert channels to route events to it. You can create multiple channels for each connection. For example, route different alerts to separate Slack channels.

Select **Environments & Topics**, expand the environment, then select **Alerts**.

Select the **Channels** tab to view, edit, or create channels.

<figure><img src="/files/caJBXq8OPBcPEaHV507i" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Alerts are always stored in Lenses even if you don't send them out to an external alerting system.
{% endhint %}

### AWS CloudWatch

Create an AWS connection in **Configuration**. Then create an AWS CloudWatch channel.

You can use the [AWS default credentials provider chain](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials-chain.html#credentials-default) instead of explicit credentials.

### Datadog

1. In **Configuration**, create a **Datadog** connection.
2. In **Alerts** → **Channels**, create a channel using that connection.

### PagerDuty

1. In **Configuration**, create a **PagerDuty** connection.
2. In **Alerts** → **Channels**, create a channel using that connection.

### Prometheus Alertmanager

1. In **Configuration**, create an **Alertmanager** connection.
2. In **Alerts** → **Channels**, create a channel using that connection.

### Slack

1. In **Configuration**, create a **Slack** connection.
2. In **Alerts** → **Channels**, create a channel using that connection.

### Webhooks

Webhooks can send alerts to services that accept HTTP requests. Use them for email, Microsoft Teams, SMS, and custom integrations.

1. In **Configuration**, create a **Webhook** connection.
2. In **Alerts** → **Channels**, create a channel using that connection.

#### Template variables

Use template variables in the request path, HTTP headers, and body. Write variables as `{{VARIABLE}}`.

* `{{LEVEL}}` — alert level, such as `HIGH` or `CRITICAL`.
* `{{CATEGORY}}` — alert category.
* `{{INSTANCE}}`, `{{SUMMARY}}`, `{{TIMESTAMP}}`, and `{{ID}}` — alert details.

Use `{{CREDS[0]}}` for a value from the connection credentials list.

#### SendGrid email example

Configure a webhook connection with host `api.sendgrid.com` and enable HTTPS. Create a channel using this connection.

Set the method to `POST`. Add these headers:

```
Authorization: Bearer <your-sendgrid-api-key>
Content-Type: application/json
```

Use this body:

```json
{
  "personalizations": [
    {
      "to": [
        {
          "email": "devops@example.com",
          "name": "DevOps and SRE"
        }
      ],
      "subject": "Production streaming platform alert"
    }
  ],
  "content": [
    {
      "type": "text/html",
      "value": "<html><body><p>Priority: {{LEVEL}}<br><br>Category: {{CATEGORY}}<br><br>Description: {{SUMMARY}}<br><small>Alert ID: {{ID}}</small></p></body></html>"
    }
  ],
  "from": {
    "email": "sender@example.com",
    "name": "Streaming platform"
  }
}
```

The sender address must match a verified SendGrid sender.

#### Zapier example

Configure a webhook connection with host `hooks.zapier.com` and enable HTTPS. Set the request path to the webhook path from Zapier.

Set the method to `POST`. You can pass a credential with this header:

```
X-Api-Token: {{CREDS[0]}}
```

Use this body:

```html
<html>
  <body>
    <h2>Streaming platform alert</h2>
    <p>Priority: <b>{{LEVEL}}</b></p>
    <p>Category: <b>{{CATEGORY}}</b></p>
    <p>Summary: {{SUMMARY}}</p>
    <p>Alert ID: {{ID}}</p>
  </body>
</html>
```

#### Microsoft Teams example

Create an incoming webhook in Microsoft Teams. Its URL includes a host and a path.

1. Create a webhook connection with host `outlook.office.com` and enable HTTPS.
2. Create a channel using that connection.
3. Set the method to `POST`.
4. Set the request path to the path from the Teams webhook URL.
5. Set the body:

```json
{
  "text": "{{CATEGORY}} {{LEVEL}} {{ID}}"
}
```

#### SMS

Use a webhook service that can send SMS messages. Zapier can route the webhook payload to an SMS provider.

##


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lenses.io/latest/user-guide/using/alerting-and-monitoring/alert-integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
