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

# New Relic

> New Relic Provider enables querying AI alerts and registering webhooks.

## Authentication

This provider requires authentication.

* **api\_key**: New Relic User key. To receive webhooks, use `User key` of an admin account (required: True, sensitive: True)
* **account\_id**: New Relic account ID (required: True, sensitive: False)
* **new\_relic\_api\_url**: New Relic API URL (required: False, sensitive: False)

Certain scopes may be required to perform specific actions or queries via the provider. Below is a summary of relevant scopes and their use cases:

* **ai.issues:read**: Required to read issues and related information (mandatory) ([Documentation](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-user-management/user-management-concepts/))
* **ai.destinations:read**: Required to read whether keep webhooks are registered  ([Documentation](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-user-management/user-management-concepts/))
* **ai.destinations:write**: Required to register keep webhooks  ([Documentation](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-user-management/user-management-concepts/))
* **ai.channels:read**: Required to know informations about notification channels.  ([Documentation](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-user-management/user-management-concepts/))
* **ai.channels:write**: Required to create notification channel  ([Documentation](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-user-management/user-management-concepts/))

## In workflows

This provider can be used in workflows.

As "step" to query data, example:

```yaml theme={null}
steps:
    - name: Query newrelic
      provider: newrelic
      config: "{{ provider.my_provider_name }}"
      with:
        nrql: {value}
        query: {value}  # query to execute
```

Check the following workflow example:

* [complex-conditions-cel.yml](https://github.com/keephq/keep/blob/main/examples/workflows/complex-conditions-cel.yml)

## Connecting with the Provider

1. Go to [https://one.newrelic.com/admin-portal/api-keys/home](https://one.newrelic.com/admin-portal/api-keys/home) to create User Key.
2. Get `api_key` and `account_id` from the key created.
3. Based on region get `api_url` from here [https://docs.newrelic.com/docs/apis/rest-api-v2/get-started/introduction-new-relic-rest-api-v2](https://docs.newrelic.com/docs/apis/rest-api-v2/get-started/introduction-new-relic-rest-api-v2) .

## Webhook Integration Modifications

The webhook integration adds Keep as a destination within the "Alerts and AI" API within New Relic.
This grants Keep access to the following scopes within New Relic:

* `ai.destinations:read`
* `ai.destinations:write`
* `ai.channels:read`
* `ai.channels:write`

## Useful Links

* [https://docs.newrelic.com/docs/apis/rest-api-v2/get-started/introduction-new-relic-rest-api-v2](https://docs.newrelic.com/docs/apis/rest-api-v2/get-started/introduction-new-relic-rest-api-v2)
