Docs
Slack Integration
Slack Integration
Route AITracer trace and alert notifications to your Slack workspace.
Notifications: This guide is for Slack webhooks when traces or alerts fire — not for ingesting model calls. For trace capture, use Agent Lab or the Trace Ingestion API.
Send trace summaries and operational alerts to Slack channels.
Setup
1. Create a Slack app with incoming webhook
- Go to https://api.slack.com/apps → Create New App → From Scratch
- Name it "AITracer", select your workspace
- Incoming Webhooks → Activate → Add New Webhook to Workspace
- Select the target channel → Allow
- Copy the webhook URL (
https://hooks.slack.com/services/...)
2. Deploy a relay (optional)
Transform AITracer webhook payloads into Slack blocks:
export default {
async fetch(request) {
const body = await request.json()
const { traceId, actionName, model, status, normalized } = body
const cost = normalized?.costUsd ? `$${normalized.costUsd.toFixed(6)}` : ""
const payload = {
blocks: [
{
type: "header",
text: { type: "plain_text", text: `Trace: ${actionName}` },
},
{ type: "divider" },
{
type: "section",
fields: [
{ type: "mrkdwn", text: `*Trace ID*\n\`${traceId}\`` },
{ type: "mrkdwn", text: `*Model*\n${model ?? "unknown"}` },
{ type: "mrkdwn", text: `*Status*\n${status}` },
{ type: "mrkdwn", text: `*Tokens*\n${normalized?.tokenCount ?? 0}` },
],
},
],
}
if (cost) {
payload.blocks.push({
type: "section",
fields: [{ type: "mrkdwn", text: `*Cost*\n${cost}` }],
})
}
await fetch(process.env.SLACK_WEBHOOK_URL!, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
})
return new Response("OK", { status: 200 })
},
}3. Connect in AITracer
Deploy the relay (e.g. npx wrangler deploy) and add the URL under Settings → Webhooks.
Built-in alerting
Set SLACK_ALERT_WEBHOOK_URL for automatic dispatch of execution failures and threshold alerts.
Result
- New traces can post to Slack with model, status, and cost when present
- Critical alerts route without custom code when env vars are set