# New Relic

EvoHub receives New Relic issues through a **Webhook** destination that an alert workflow notifies. An active issue opens an EvoHub alert, and the issue closing resolves it. New Relic's default payload template works as it is.

## Set it up

:::steps
### Create the integration
In EvoHub, go to **On-Call → Integrations → + Add Integration**, choose **New Relic**, pick an **Escalation Policy** and click **Create Integration**. Copy the **Webhook URL**.
### Add a webhook destination
In New Relic, go to **Alerts → Destinations** and add a **Webhook**. Set **Endpoint URL** to your webhook URL:

```text
https://evohub.io/ingest/newrelic?key=YOUR_INTEGRATION_KEY
```
### Create a workflow
Go to **Alerts → Workflows**, create a workflow for the policies that should page, and notify through the webhook destination. Leave the payload template as it is.
:::

## Turn on auto-resolve

No extra setup is needed. When the workflow sends the update for an issue that is closed or deactivated, EvoHub resolves the matching alert. If the workflow only sends updates for new issues, alerts stay open until someone resolves them in EvoHub.

## What EvoHub reads

| EvoHub alert | Taken from |
| --- | --- |
| Title | `title`, else the first alert condition name, else "New Relic Alert". |
| Description | "Policy: " and the first alert policy name. |
| Labels | `policy` and `condition` (the first policy and condition names). |
| Link | `issueUrl` from the default template, the issue in New Relic. It opens from the alert. |
| Fingerprint | The issue ID (`issueId`, or `id` in the default template). |

### Severity

| New Relic priority | EvoHub severity |
| --- | --- |
| CRITICAL | critical |
| HIGH | high |
| MEDIUM | medium |
| LOW | low |
| missing or anything else | medium |

## Resolve and deduplication

- An issue whose `state` is **CLOSED** or **DEACTIVATED** (or **RESOLVED**, for templates that send it) resolves the open alert for that issue ID. Any other state opens an alert.
- Further updates for an issue whose alert is still open, such as **ACTIVATED** after **CREATED**, are recorded as **Retriggered**, so one issue is one EvoHub alert.

## Troubleshooting

- **`401 INVALID_KEY`**: the URL's key is wrong or the integration is disabled. Copy the **Webhook URL** again from the integration.
- **Nothing arrives**: check that the workflow's filter matches the issues and that it notifies the webhook destination.
- **`400 INVALID_BODY`**: the payload template was changed so that it no longer renders a JSON object. Go back to the default template.
- **One alert for several issues**: a custom template that leaves out the issue ID makes EvoHub key the alert by its title. Keep `issueId` (or the default `id`) in the payload.

## Related

- [Integrations overview](https://docs.evohub.io/integrations-overview.md)
- [Datadog](https://docs.evohub.io/datadog.md)
- [Escalation policies](https://docs.evohub.io/escalation-policies.md)
