Docs
Discord Integration
Discord Integration
Route AITracer trace and alert notifications to your Discord server.
Notifications: This guide is for Discord webhooks — not model ingest. Capture traces via Agent Lab or the Trace Ingestion API.
Send trace notifications to Discord channels.
Setup
1. Create a Discord webhook
- Server Settings → Integrations → Webhooks → New Webhook
- Name it "AITracer" and pick a channel
- Copy the webhook URL
2. Deploy a relay
export default {
async fetch(request) {
if (request.method !== "POST") return new Response("Method not allowed", { status: 405 })
const body = await request.json()
const { traceId, actionName, model, status } = body
const color =
status === "completed" ? 0x3ddc97 :
status === "failed" ? 0xef4444 :
status === "timeout" ? 0xf97316 : 0x6b7280
const embed = {
title: actionName,
color,
fields: [
{ name: "Trace ID", value: `\`${traceId}\``, inline: true },
{ name: "Model", value: model ?? "unknown", inline: true },
{ name: "Status", value: status, inline: true },
],
footer: { text: "AITracer" },
timestamp: body.ingestedAt ?? new Date().toISOString(),
}
await fetch(process.env.DISCORD_WEBHOOK_URL!, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ embeds: [embed] }),
})
return new Response("OK", { status: 200 })
},
}3. Connect
Add the relay URL in Settings → Webhooks.
Optional: slash commands
Extend a Discord bot to list recent traces via GET /api/traces with your API key.
Result
Rich embeds per trace: status color, model, and trace id — without requiring governance or verification features.