Skip to content
betterstack-alchemyUnofficial

Incidents.NewRelicIntegration

Kind ResourceType id BetterStack.Incidents.NewRelicIntegrationSource src/Incidents/NewRelicIntegration.tsLive test gated Lifecycle test runs against the offline mock; a live run exists but is gated behind BETTERSTACK_TEST_PAID_INTEGRATIONS=1 because the test account's plan refuses this integration (test/Incidents/NewRelicIntegration.test.ts).

Receives alerts from New Relic and opens Better Stack incidents. Better Stack gives you a webhookUrl (a secret, Redacted): in New Relic, create a Webhook destination with that URL and send a workflow’s issues to it. alertingRule decides whether only critical alerts or also warnings open incidents.

Every prop updates in place except teamId, which replaces the integration (and gives it a new webhookUrl). name defaults to a generated unique name. Removing escalationPolicyId or teamWait clears them. Without an escalation policy, call/sms/email/push/ criticalAlert decide how the current on-call person is alerted.

Alert through an escalation policy

const integration = yield* BetterStack.Incidents.NewRelicIntegration("new-relic", {
name: "New Relic alerts",
escalationPolicyId: policyId,
});

The URL is a secret: export it from the stack and paste it into New Relic, or hand it to whatever provisions New Relic.

A stack output

const integration = yield* BetterStack.Incidents.NewRelicIntegration("alerts", { escalationPolicyId: policyId });
return { webhookUrl: integration.webhookUrl };

alert_and_warn

yield* BetterStack.Incidents.NewRelicIntegration("warnings", { alertingRule: "alert_and_warn" });

Stop opening incidents during maintenance

yield* BetterStack.Incidents.NewRelicIntegration("new-relic", { name: "New Relic alerts", paused: true });

alertingRule "alert" | "alert_and_warn" | string

Which New Relic alert levels open incidents.

call boolean

Whether to call the on-call person. Ignored while an escalation policy is set.

criticalAlert boolean

Whether to send a critical push notification that ignores the mute switch and Do Not Disturb mode. Ignored while an escalation policy is set.

email boolean

Whether to send an e-mail to the on-call person. Ignored while an escalation policy is set.

escalationPolicyId string | null

ID of the escalation policy for alerts, or null to alert the current on-call person directly.

name string

Integration name. Defaults to a unique name generated from the stack, stage and logical id.

paused boolean

Whether the integration is paused. A paused integration opens no incidents.

push boolean

Whether to send a push notification to the on-call person. Ignored while an escalation policy is set.

recoveryPeriod number | null

Seconds a resolved alert must hold before the incident resolves. Has no effect for this integration, since an incident resolves as soon as New Relic reports the alert as resolved.

sms boolean

Whether to send an SMS to the on-call person. Ignored while an escalation policy is set.

teamId string

Team that owns the resource, such as t123. Defaults to the credentials' team (BETTERSTACK_TEAM_ID, or the profile's team). Changing it replaces the resource.

teamWait number | null

Seconds to wait before escalating to the whole team. 0 alerts the whole team right away, and null never escalates to the team. Ignored while an escalation policy is set.

id string always set

The incidents_new_relic_integration's id.

alertingRule "alert" | "alert_and_warn"

Which New Relic alert levels open incidents.

call boolean

Whether to call the on-call person. Ignored while an escalation policy is set.

criticalAlert boolean

Whether to send a critical push notification that ignores the mute switch and Do Not Disturb mode. Ignored while an escalation policy is set.

email boolean

Whether to send an e-mail to the on-call person. Ignored while an escalation policy is set.

escalationPolicyId string | null

ID of the escalation policy for alerts, or null to alert the current on-call person directly.

name string | null

Integration name.

paused boolean

Whether the integration is paused. A paused integration opens no incidents.

push boolean

Whether to send a push notification to the on-call person. Ignored while an escalation policy is set.

recoveryPeriod number | null

Seconds a resolved alert must hold before the incident resolves. Has no effect for this integration, since an incident resolves as soon as New Relic reports the alert as resolved.

sms boolean

Whether to send an SMS to the on-call person. Ignored while an escalation policy is set.

teamId string

Team that owns this integration, such as t123.

teamName string

Name of the team that owns this integration.

teamWait number | null

Seconds to wait before escalating to the whole team. 0 alerts the whole team right away, and null never escalates to the team. Ignored while an escalation policy is set.

webhookUrl string | Redacted<string>

The URL to paste into New Relic. Alerts New Relic sends to it open incidents.

NewRelicIntegration.lookup(props) reads an object this stack does not manage. It is never created, updated or deleted.

id string required

The integration's id.

teamId string

Team that owns it, such as t123. Defaults to the credentials' team.