Back to Articles How-to

How to Send Discord Alerts from a REST API

Julio Andres March 26, 2026 6 min read Discord · Backend · API

Discord isn't just for gaming anymore. A lot of dev teams use it as their main communication tool — and it turns out it's a great place to receive alerts from your servers too. Error happened? Discord message. Deploy went out? Discord message. Payment came in? You get the idea.

The question is how to wire it up. Discord has webhooks, which work, but they come with some trade-offs that get annoying fast. Let me walk you through both approaches so you can pick the one that makes sense for your setup.

Option 1: Discord Webhooks (The Built-in Way)

Discord lets you create webhook URLs for any channel. You go to your server settings, pick a channel, create a webhook, and you get a URL. Then you POST to it:

Discord Webhook
curl -s -X POST \
  https://discord.com/api/webhooks/<WEBHOOK_ID>/<WEBHOOK_TOKEN> \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Deploy finished: v2.4.1 is live on production."
  }'

Simple enough. But here's what you'll run into once you start using this for real:

For a personal project or a quick hack, webhooks are fine. But once you have a team or multiple services sending alerts, it gets messy.

Option 2: A Notification API (The Flexible Way)

Instead of talking to Discord directly, you send your alerts to a notification API that handles the delivery for you. With NotificationsBot, the same API call can reach Discord, Telegram, Slack, or Email — depending on who's subscribed to the channel.

cURL
curl -s -X POST https://api.notificationsbot.com/event \
  -H "Authorization: Bearer $NOTIFICATIONSBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "server-alerts",
    "title": "Deploy finished",
    "message": "v2.4.1 deployed to production successfully."
  }'

That's it. If you have a Discord subscriber on that channel, they get the message on Discord. If you also have someone on Telegram and someone on Slack, they all get it too. One API call, multiple platforms, zero extra code.

The key difference

With Discord webhooks, your code is tightly coupled to Discord. With a notification API, your code just says "something happened" and the routing is handled separately. You can change who gets notified and where without touching a single line of code.

Setting Up Discord Alerts with NotificationsBot

If you don't have an account yet, here's the quick setup:

From here, every event you send to that channel shows up in Discord. The whole setup takes about 5 minutes.

Real Examples

Here are patterns I use in production. They all work the same way — make an HTTP POST, and the message shows up on Discord (and wherever else you've configured).

Error Alerts from Your Backend

Python
import os
import requests

API_KEY = os.environ["NOTIFICATIONSBOT_API_KEY"]

def alert(title: str, message: str, channel: str = "errors"):
    requests.post(
        "https://api.notificationsbot.com/event",
        headers={"Authorization": f"Bearer {API_KEY}"},
        json={"channel": channel, "title": title, "message": message},
        timeout=5,
    )

# In your exception handler:
try:
    charge_customer(order)
except Exception as e:
    alert("Payment failed", f"Order #{order.id} — {e}")

Deployment Notifications from CI/CD

GitHub Actions step
# Add as the last step in your workflow
- name: Notify team
  run: |
    curl -s -X POST https://api.notificationsbot.com/event \
      -H "Authorization: Bearer ${{ secrets.NOTIFICATIONSBOT_API_KEY }}" \
      -H "Content-Type: application/json" \
      -d "{
        \"channel\": \"deployments\",
        \"title\": \"Deployed to production\",
        \"message\": \"${{ github.repository }} deployed by ${{ github.actor }}\"
      }"

Server Monitoring Alerts

Node.js
// Check disk space and alert if it's getting full
const { execSync } = require("child_process");

const usage = parseInt(
  execSync("df / --output=pcent | tail -1").toString().trim()
);

if (usage > 85) {
  await fetch("https://api.notificationsbot.com/event", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.NOTIFICATIONSBOT_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      channel: "monitoring",
      title: "Disk space warning",
      message: `Server disk usage is at ${usage}%. Time to clean up.`,
    }),
  });
}

Discord Webhooks vs NotificationsBot

Here's a side-by-side to help you decide:

If Discord is the only platform you'll ever use and you have one channel to notify, webhooks are the simplest option. But the moment you add a second platform, a second team, or need any kind of visibility into what was sent and when — a notification API saves you a lot of headaches.

Bonus: Combine Discord with Telegram

One of the most useful setups I've seen is having the same channel notify both Discord (for the team chat) and Telegram (for the on-call person's phone). The team sees the alert in Discord during work hours, and the on-call engineer gets a Telegram ping at 3 AM.

With NotificationsBot, this is just adding two subscribers to the same channel — one Discord, one Telegram. No code changes, no duplicate API calls. The routing is completely separate from your application logic.

Keep it actionable

Don't flood your Discord with noise. Set up separate channels for different severity levels — critical for things that need immediate action, info for things that are good to know. Your team will thank you.

Send Your First Discord Alert in 5 Minutes

Create a free account, add a Discord subscriber, and start getting alerts from your server. No credit card, no bot setup.

Start for free