New Relic webhooks in production: duplicates, ordering, retries and timeouts

Published · Updated

This guide covers the problems New Relic webhooks cause in production and how to handle each one. What New Relic sends and how it works is on the New Relic webhooks overview, and the Basic credential check is on Verify New Relic webhooks. The body is a template you write, so there's no list of events to read.

New Relic documents how failed sends are reported, but not how long it waits for a response or whether it retries. Where this guide says something isn't documented, plan for the worst case and test it against your own account.

At a glance

ProblemWhat to doWith Event Gateway
TimeoutsRespond quickly; process in a background jobAccepts the request at once, then queues it for your service
Repeat notificationsUpsert on issueId; turn off triggers you don't useDrops repeats on the fields you choose
OrderingCompare updatedAt; never overwrite newer stateLogs every request and attempt, so you can see arrival order when debugging
Retries and snoozingAlert on NotificationError; reconcile through NerdGraphAccepts notifications while your service is down and retries on your schedule
Designing the templateSend issueId, state, triggerEvent and a schema versionNormalises differing shapes with transformations
TestingUse Preview, then Send test notificationForwards to localhost and replays past requests
Other limitsUse Basic credentials; respect throttling; allow New Relic's network blocksDelivers at a rate you set

New Relic webhook timeouts and slow handlers

New Relic publishes no timeout for webhook destinations, so respond as fast as you can and do the work in a background job.

Why it happens: New Relic does give up on slow endpoints: a destination can show the status TIMEOUT_ERROR, which means it isn't receiving notifications because of a timeout. The docs don't say how long New Relic waits, or which response codes count as success. Remediation scripts and ticket creation can easily take longer than a sender is willing to wait.

Fix it in your handler:

  1. Check the Basic credentials, store the raw notification and respond with a 2xx.
  2. Process the notification from a queue. See why to process webhooks asynchronously.
  3. Watch the destination's status in the Destinations table, where a timeout shows up.

With Event Gateway: Hookdeck accepts each New Relic request immediately, then queues it and delivers it to your service at a rate it can handle, so your handler can take as long as it needs without New Relic seeing a timeout.

Repeat New Relic notifications

One issue sends several notifications by design. Update one record per issueId instead of creating something new for each request.

Why it happens: A workflow fires on notification triggers, and by default a Webhook destination is notified on all six: Activated, Acknowledged, Investigating, Closed, Priority changed and Other updates. Other updates covers an alert event being added or closed and another issue being merged in, so a busy issue can notify many times. New Relic documents no delivery ID, and its docs don't say whether a single notification can be sent twice.

Fix it in your handler:

  1. Include issueId and updatedAt in your template, and store them. See our guide to webhook idempotency.
  2. Upsert on issueId, so a second request updates the ticket rather than opening another.
  3. Turn off triggers you don't act on: click the three dots on the destination in the workflow, then Notify when. The Activated trigger has to stay on.

With Event Gateway: Hookdeck deduplication can drop repeated notifications based on fields you choose, such as issueId and updatedAt.

Out-of-order New Relic notifications

New Relic doesn't document any ordering, so don't depend on arrival order.

Why it happens: Each notification is its own HTTP request, and nothing in the delivery orders them unless your template includes a timestamp. If a send fails while the issue is changing, the next one your service sees may skip a state.

Fix it in your handler:

  1. Include updatedAt in your template, which is when the issue was last updated.
  2. Apply a notification only if its updatedAt isn't older than the one you've stored.
  3. Treat each body as the issue's current state, not as a step in a sequence. If you need the full history, read it from New Relic.

With Event Gateway: Hookdeck logs every request and attempt, so you can see the order they arrived in when debugging.

New Relic webhook retries and snoozed destinations

New Relic documents no retry policy for webhook destinations, and a failure can pause the destination, so assume a failed notification won't arrive and reconcile afterwards.

Why it happens: The only retry New Relic describes in its notification log is for email. For a failed send to a destination, its docs describe two things. The error goes to NrIntegrationError with the category NotificationError, and New Relic "snoozes" the destination: if a send fails within a two-hour period, it stops sending to that destination for a few minutes. Its docs don't say that notifications skipped in that time are sent later, so one failure on your side can cost you other alerts.

Fix it in your handler:

  1. Build an alert condition on SELECT count(*) FROM NrIntegrationError WHERE category = 'NotificationError' and have it notify a different destination, so a broken endpoint doesn't hide its own failure.
  2. Check the issue notification log under Alerts, Workflows after an outage. It shows each notification's status and error details, and the JSON payload for webhook destinations.
  3. List issues through NerdGraph after an outage, and compare them with what you stored.

With Event Gateway: Hookdeck accepts and stores each notification as it arrives, so an outage on your side doesn't fail New Relic's send. It delivers to your service with retries you configure, issues alert you when deliveries fail, and you can replay any notification once your service is back.

Designing the New Relic payload template

New Relic has no event names, so your template is the contract. Include everything your handler needs to route a notification.

Why it happens: The body is whatever the workflow's template renders, and different workflows can send different shapes to one endpoint. New Relic starts you from a default JSON template, but its docs don't print it, so read it in the editor rather than assuming its fields.

Three documented variables describe what happened:

  • state is the issue's life cycle state: CREATED, ACTIVATED or CLOSED. New Relic's migration notes say it has no value for acknowledged, although its workflows page describes a change from ACKNOWLEDGED to INVESTIGATING, so keep a default branch for values you don't recognise.
  • isAcknowledged is true or false.
  • triggerEvent says what caused the notification: STATE_CHANGE, INCIDENT_ADDED, INCIDENT_CLOSED, CLOSE_INACTIVE, CLOSE_TTL, USER_ACTION, PRIORITY_CHANGED or MERGE_REQUEST.

A small template for your own receiver might be:

{
  "schema_version": 1,
  "issue_id": {{json issueId}},
  "title": {{json issueTitle}},
  "state": {{json state}},
  "trigger": {{json triggerEvent}},
  "acknowledged": {{json isAcknowledged}},
  "priority": {{json priority}},
  "url": {{json issuePageUrl}},
  "updated_at": {{updatedAt}},
  "closed_at": {{#if issueClosedAtUtc}}{{json issueClosedAtUtc}}{{else}}null{{/if}}
}

Fix it in your handler:

  1. Keep one template for every workflow that targets the same endpoint, and treat changes to it like an API change.
  2. Use {{json ...}} for strings, so a quote in a title doesn't break the JSON.
  3. Wrap optional variables in {{#if}}. A missing attribute with a nested value fails to render, and New Relic won't save the template.
  4. Use issueId rather than incident_id if you're moving from notification channels, because New Relic has deprecated the classic ID.
  5. If your handler resolves the issue, acknowledge or close it through NerdGraph, so both systems agree on its state.

With Event Gateway: Hookdeck keeps every request with its full body, so you can see exactly what a changed template sent and replay it against your fixed handler. Transformations can normalise differing shapes before they reach your service.

Testing New Relic webhooks

Check the render in Preview, then use Send test notification to confirm your endpoint accepts it.

What to watch for: The editor won't save a template that doesn't produce valid JSON, so a passing Preview tells you about the syntax and nothing about your handler. Issue-specific variables such as accumulations.tag.foo don't appear in the variables menu until an issue has contained them, so guard them with {{#if}} rather than waiting for one. New Relic's docs don't show the request it sends, so use your first test to confirm that the Authorization: Basic header arrives.

Test it:

  1. Open the workflow's template, check Preview and click Send test notification.
  2. Confirm the result in the issue notification log, where a test shows the operation Test and the payload that was sent.
  3. Run your handler against a real issue before you rely on it, because a test can't show you how often a busy issue notifies.

With Event Gateway: hookdeck listen 3000 new-relic --path /webhooks/new-relic forwards requests to your machine through a public URL, and you can replay past requests while you fix your handler.

Other New Relic webhook limits

A destination's credentials are static, so serve your endpoint over HTTPS and change them with care.

Why it happens: A Webhook destination offers Basic Authentication, a Bearer Token, a secure URL and encrypted custom headers, and New Relic signs none of them. A static credential authenticates the sender, not the body, and with no signed timestamp a captured request can be replayed.

Fix it in your handler:

  1. Serve the endpoint over HTTPS, use a long random password and change it on the destination and in your environment together.
  2. Allow New Relic's network blocks if you filter by IP: 162.247.240.0/22, 152.38.128.0/19, 185.221.84.0/22, 212.32.0.0/20 and 64.251.192.0/20, also published as a JSON file. They're shared with other New Relic traffic, so keep checking the credentials.
  3. Don't throttle New Relic hard. A destination shows THROTTLING_WARNING and stops receiving notifications when requests exceed your rate limit, so a burst of alerts can trip it.
  4. Plan changes to protected values. A saved secure URL has to be replaced whole, an encrypted header value has to be deleted and rewritten, and a header on the destination overrides the same key on the channel.

With Event Gateway: The New Relic source checks Basic credentials only, so choose Basic Authentication on the destination. If you're tied to a Bearer Token or custom header, check it in your own handler. Hookdeck then delivers to your service at a max delivery rate you set, so a burst of alerts doesn't reach your rate limit.

Keep an outage on your side from snoozing your New Relic destination.

Event Gateway checks the Basic credentials, stores each notification as it arrives and delivers it to your service with retries you control, so New Relic's send succeeds even while your service is down.

Not affiliated with New Relic. Facts are compiled from public sources and linked inline.