Website Change Alerts to Discord: Webhook Relay Setup
Post AyeWatch website change alerts to a Discord channel with a signed webhook and a 25-line relay. Includes the code, the Discord limits and the retry behavior.
By AyeWatch Team4 min read
Short answer: AyeWatch's own Discord connection is not live yet, so send website change alerts to Discord through its signed webhook. A small relay checks the signature and posts the alert to a Discord channel's webhook URL. You need a paid AyeWatch plan and about 25 lines of code.
AyeWatch is an AI monitoring app for the internet, web pages and social media. On paid plans it can send each alert to a signed webhook, which is a POST request carrying JSON and an HMAC-SHA256 signature header.
Where Discord stands in AyeWatch today
As of November 2026, the Integrations screen lists Discord with a Coming soon label, and its Connect Discord button is switched off. Slack is the live chat integration. The signed webhook is live, and it reaches Discord with one small piece in the middle.
Why not point AyeWatch at the Discord URL
Three details get in the way. First, AyeWatch's body has no message layout: the headline sits in headline, not in the text Discord shows. Second, Discord accepts at most 2000 characters in content, and AyeWatch's content field carries the full update. Third, AyeWatch treats any non-2xx reply as a failed delivery and retries up to 10 times, so one refused update turns into ten refused requests.
A relay fixes all three. It builds a short message, trims it and tells AyeWatch whether Discord accepted it.
The relay
This Cloudflare Worker checks the signature on the raw bytes, builds the message and posts it to your Discord webhook. Store AYEWATCH_SECRET and DISCORD_WEBHOOK_URL as Worker secrets. Any host that runs JavaScript with the Fetch API works the same way.
export default {
async fetch(request, env) {
const raw = await request.arrayBuffer();
const header = request.headers.get("x-ayewatch-signature") || "";
const hex = header.replace("sha256=", "");
const sig = Uint8Array.from(hex.match(/../g) || [], (h) => parseInt(h, 16));
const key = await crypto.subtle.importKey(
"raw",
new TextEncoder().encode(env.AYEWATCH_SECRET),
{ name: "HMAC", hash: "SHA-256" },
false,
["verify"]
);
const ok = await crypto.subtle.verify("HMAC", key, sig, raw);
if (!ok) return new Response("Invalid signature", { status: 401 });
const e = JSON.parse(new TextDecoder().decode(raw));
const link = e.evidence && e.evidence[0] ? e.evidence[0].source_url : "";
const text = ["**" + (e.headline || e.topic_name) + "**", link, e.content]
.filter(Boolean)
.join("\n");
const res = await fetch(env.DISCORD_WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
content: text.slice(0, 2000),
allowed_mentions: { parse: [] },
}),
});
return new Response(null, { status: res.ok ? 200 : 502 });
},
};
crypto.subtle.verify compares in constant time. The empty parse list in allowed_mentions stops page text such as @everyone from pinging the channel. When Discord refuses the message, the Worker answers 502, so AyeWatch retries. Discord's own success reply is 204 No Content, which the Worker turns into a plain 200 for AyeWatch.
The alert the relay receives
This is a made-up payload with the fields from the webhook docs. Optional fields such as evidence can be missing, which is why the relay checks for them.
{
"topic_id": 3204,
"topic_name": "https://larkspurcoffee.example/menu",
"update_id": 61877,
"headline": "Larkspur Coffee adds a Cardamom Oat Latte",
"content": "The menu page lists a new seasonal drink, Cardamom Oat Latte, at $5.40. The Pumpkin Chai is now marked sold out.",
"created_at": "2026-11-27T09:14:00Z",
"evidence": [
{ "quote": "Cardamom Oat Latte 5.40", "source_url": "https://larkspurcoffee.example/menu" }
]
}
Sample rule: Alert me when Larkspur Coffee adds a new drink to its menu page or marks a drink as sold out. Ignore price rounding and photo changes.
When this setup is the wrong one
- You do not want to run code. Receive the webhook in Make or Zapier and add their Discord step instead of the Worker.
- A large public server. Everyone in the channel reads each alert, and anyone who gets the webhook URL can post to it. Keep the URL in secrets and delete the webhook in Discord if it leaks.
- Fast reaction. Checks run on a schedule, hourly on Pro and faster in ASAP mode on Pro+. Discord is not a pager.
- Pages behind a login. AyeWatch reads public pages and cannot sign in.
Cost and effort
Webhooks need a paid plan. AyeWatch Pro is $9/mo with 50 topics and hourly checks; Pro+ is $19/mo with 200 topics and ASAP mode. Every plan starts with a 7-day free trial. Most checks use 1 credit. The relay is about 25 lines and needs somewhere to run, so check your host's pricing page.
Set up the Discord route
- In Discord, open Server Settings, then Integrations, then Webhooks. Create a webhook (New Webhook if one exists), pick the channel and copy its URL. You need the permission to manage webhooks.
- Deploy the relay above and store the Discord URL as
DISCORD_WEBHOOK_URL. Put any placeholder inAYEWATCH_SECRETfor now. - Create the monitor in AyeWatch and write the rule.
- Open Notification settings, Webhook, paste the relay URL and select Save Webhook. AyeWatch emails the account owner when the URL changes.
- Reveal the signing secret on that screen and store it as
AYEWATCH_SECRET. Deliveries that arrive before this step fail the check and are retried. - Wait for the next alert. The AyeWatch webhook screen has no test-send button, so the first request is a real update.
| Discord limit | Value | How the relay handles it |
|---|---|---|
| Message content | 2000 characters | Cut with slice(0, 2000) |
| Embed description | 4096 characters | Not used. Plain content keeps the relay short. |
| Success reply | 204 No Content | Relay returns 200 to AyeWatch |
| Mentions | Text such as @everyone can ping | allowed_mentions with an empty parse list |
Start a monitor in under a minute
Describe a topic or paste a URL. Cancel before the trial ends and you pay nothing.
Try it free for 7 daysThe bottom line
Make a test channel in your Discord server, deploy the relay against it and let one monitor run for a day. Move it to the real channel once the messages read the way you want.
FAQ
Does AyeWatch send alerts to Discord directly?
Not yet. The Discord card on the Integrations screen is marked Coming soon as of November 2026. The signed webhook works today with a small relay.
Why does the relay check the signature?
Anyone who learns the relay URL could post to it. AyeWatch signs each delivery with HMAC-SHA256 in the X-AyeWatch-Signature header, and the relay rejects anything that fails.
What is the Discord message length limit?
2000 characters in content. Embeds allow a 4096-character description and up to 10 embeds per message.
What happens if Discord is down?
The relay answers 502 and AyeWatch retries with exponential backoff, up to 10 attempts.
Can one webhook serve several Discord channels?
Yes. Each account has one AyeWatch webhook, so the relay can read topic_id and post to a different Discord URL per monitor.