New Relic alerts integration to Discord
In a previous post, we have seen how to set up the New Relic for full-stack observability with no cost. Identifying the issues is one thing. But it’s only worthwhile when we can trigger timely alerts to the right team for corrective actions.
New relic by default sends email alerts. But emails are not guaranteed real-time. There are many integrations available for different channels on New Relic ( Slack, PagerDuty, etc ). Most of them require a paid membership.
If you are someone trying to add observability to your personal project or a small startup trying to start with alerts, Discord is a better option. It is free and can be used to create channels with user restrictions. But there is no direct channel integration available for discord. So in this post, we will see how to set up a discord account and link a channel to receive alerts from New Relic.
Before you proceed, if you have not read the previous blog on the New Relic setup, please read it here.
Discord is an instant messaging platform originally created for gamers’ collaboration. But it has grown out of the initial use case and is now being used as a very popular general messaging tool by many organizations and individuals.
Though Slack is the king of enterprise messaging, the next best free thing that you could find and use is Discord. You can create your own servers ( like a namespace ) and add channels ( like in slack ). We will see how to link a specific channel in Discord to New Relic alerts so that you can add your DevOps monitoring team can manage it.
You can sign up for free in Discord by going to https://discord.com/register. Provide the necessary details and you will be logged in.
Channel setup for Alerts
On the left side, click on the username dropdown and you will have an option to “Create Channel”.
Choose “Text” as the type, provide a channel name and make it a “Private Channel” so that you can control who has access to it.
This will create the channel. Now we need an option to deliver the alerts to this channel from New Relic. That is done via webhooks and we need to go to the channel settings for getting the webhook URL.
Click on the settings icon on the channel and choose “Integrations” -> Click on “Webhooks”. There will be a default webhook pre-created as “Captain Cook”. You may edit the name to something like “New Relic Alerts” and click on “Copy Webhook URL”
Keep the URL handy as we will need to configure the same in the New Relic channel setup.
Once the Discord channel setup is done and the webhook URL is created, we can go to New Relic and create a new Alert channel.
Configure Discord channel
Goto Alerts & AI and scroll to the bottom of the left pane. You can see the “Channels” option there.
Click on “Channels” and it will list the currently enabled channels. Click “New notification channel”.
In the list of providers, we don’t have Discord as an option. But there is a workaround for Discord to work in compatibility mode with Slack. So choose the provider as Slack and put in the details.
Give a name for the channel ( this is not the discord channel name, it’s a name for the New Relic channel ).
For the webhook URL, we need to append the URL copied from discord with
/slack to make it compatible with slack.
For eg: If your URL is
https://discord.com/api/webhooks/969694599991327/D0IaxIyxxmI_mt2NyZmp2_1Uk903jhaVZyxKtSPARHemElbj5ee0Uvh-27 , you need to make it as
Provide the channel name as the name of the channel we created in discord ( starting with # )
That’s it. Save the configuration and the new channel is ready.
Testing the channel
You can test the channel by going to the new Channel created and clicking on the “Send a test notification”
If all the configurations are correctly done, you should receive the notification in the Discord channel configured.
Enable discord channel for alerts
Adding a channel does not add it to the alerts. We need to go to individual alerts and configure it to deliver a notification in the newly created channel.
Head to the Alerts -> Alert Conditions (Policies)
Choose “Golden Signals” and click on the tab “Notification channels”. See if your new one is already listed there. If yes, alerts for Golden Signals ( throughput, CPU, Mem, latency etc ) will be alerted to Discord.
If it’s not listed, then click on the “Add notification channels” and enable the new Discord channel you created. Note that it will be under “Slack” section.
You follow the same method for any other custom alert conditions that you have and enable the Discord channel. Please note that the alerts won’t be sent to new Discord channel unless you have explicitly enabled that channel in the alert conditions.
With the New Relic – Discord integration, you have complete working identification and alerting mechanisms for your systems. You can invite the users to discord and have the right team have access to the alerts channels based on the roles.
Let me know if you have queries in the setup or need some help with the configurations.