> ## Documentation Index
> Fetch the complete documentation index at: https://docs.obsy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# New Relic alerts

> Route New Relic issue notifications to Obsy via Workflow webhook.

## Get your Obsy webhook URL

Your per-org New Relic webhook URL is:

```
https://api.obsy.ai/api/v1/webhooks/{orgId}/newrelic
```

Find your `{orgId}` in **Settings → Organization**.

## Create a Webhook destination in New Relic

1. In New Relic, go to **Alerts → Destinations**.
2. Click **Add destination** and choose **Webhook**.
3. Set:
   * **Name**: `Obsy`
   * **Endpoint URL**: your Obsy webhook URL
4. Under **Custom headers**, no additional headers are needed.
5. Click **Save destination**.

## Create a Workflow

1. Go to **Alerts → Workflows** and click **Add a workflow**.
2. Set a name (e.g. `Obsy routing`).
3. Under **Filter data** — optionally restrict which issues trigger the workflow (leave blank for all).
4. Under **Notify**, click **Add channel** and select the `Obsy` webhook destination.
5. Under **Custom payload**, use the default JSON template or paste the Obsy-compatible template below.
6. Click **Activate workflow**.

### Recommended payload template

```json theme={null}
{
  "issueId": "{{ issueId }}",
  "issueTitle": "{{ issueTitle }}",
  "state": "{{ state }}",
  "priority": "{{ priority }}",
  "policyName": "{{ policyName }}",
  "conditionName": "{{ conditionName }}",
  "accountId": {{ accountId }},
  "accountName": "{{ accountName }}",
  "issueUrl": "{{ issuePageUrl }}",
  "entityName": "{{ accumulations.entityName.[0] }}",
  "entityType": "{{ accumulations.entityType.[0] }}",
  "labels": {
    "environment": "{{ accumulations.tag.environment.[0] }}"
  },
  "issueCreatedAt": {{ createdAt }},
  "activatedAt": {{ activatedAt }}
}
```

## Alert payload mapping

| New Relic field              | Obsy field                                                                    |
| ---------------------------- | ----------------------------------------------------------------------------- |
| `issueTitle`                 | Alert name                                                                    |
| `policyName / conditionName` | Description                                                                   |
| `state`                      | Status (ACTIVATED → firing, RESOLVED → resolved, ACKNOWLEDGED → acknowledged) |
| `priority`                   | Severity (CRITICAL → critical, HIGH/MEDIUM → warning, LOW → info)             |
| `entityName`                 | Service name                                                                  |
| `labels.environment`         | Environment                                                                   |
| `issueId`                    | `annotations.newrelic_issue_id`                                               |
| `issueUrl`                   | `annotations.newrelic_issue_url`                                              |

## Troubleshooting

<AccordionGroup>
  <Accordion title="Workflow fires but Obsy shows no alert">
    Open New Relic's Workflow log and check for HTTP errors on the delivery. A `400` means the payload is malformed — ensure you're using the recommended template above.
  </Accordion>

  <Accordion title="State shows as 'firing' even when acknowledged in New Relic">
    New Relic sends a separate `ACKNOWLEDGED` state transition. If you don't see it in Obsy, verify the Workflow is configured to fire on all state changes, not just `ACTIVATED`.
  </Accordion>
</AccordionGroup>
