How to Send AI Agent Safety Alerts to Discord
SafeClaw by Authensor sends real-time AI agent safety alerts to your Discord server through webhook integration. When an AI agent action is denied, requires approval, or triggers an audit anomaly, SafeClaw notifies your team instantly with rich embedded messages. SafeClaw supports Claude and OpenAI agents, ships with 446 tests, and provides hash-chained audit logs.
Prerequisites
- SafeClaw installed (
npx @authensor/safeclaw) - A Discord server with admin or webhook management permissions
- A Discord webhook URL for your target channel
Step 1: Create a Discord Webhook
- Open your Discord server and navigate to the channel where you want alerts (e.g.,
#ai-safety-alerts). - Click the gear icon to open Channel Settings.
- Go to Integrations > Webhooks.
- Click New Webhook, name it "SafeClaw Alerts", and optionally set an avatar.
- Click Copy Webhook URL. It looks like:
https://discord.com/api/webhooks/1234567890/abcdefg...
Step 2: Configure SafeClaw for Discord
Add the Discord webhook to your .safeclaw/policy.yaml:
version: 1
default: deny
notifications:
discord:
webhook_url: "${DISCORD_WEBHOOK_URL}"
username: "SafeClaw"
events:
- action.denied
- action.prompted
- audit.integrity_failure
embed_color: "#FF4444"
rules:
- action: file.read
paths:
- "src/**"
decision: allow
- action: file.write
paths:
- "src/**"
decision: prompt
- action: shell.execute
decision: deny
Set the environment variable:
export DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/1234567890/abcdefg..."
Step 3: Customize Discord Embeds
SafeClaw sends Discord embed messages with structured fields. You can customize the appearance:
notifications:
discord:
webhook_url: "${DISCORD_WEBHOOK_URL}"
username: "SafeClaw"
avatar_url: "https://authensor.com/safeclaw-icon.png"
embed_color_map:
denied: "#FF4444"
prompted: "#FFAA00"
allowed: "#44FF44"
integrity_failure: "#FF0000"
footer: "SafeClaw by Authensor | Deny-by-Default"
Each embed includes the action type, target resource, policy decision, agent identifier, timestamp, and hash chain reference as separate fields.
Step 4: Route Events to Different Channels
For larger teams, send different event types to different channels:
notifications:
discord:
routes:
- webhook_url: "${DISCORD_CRITICAL_WEBHOOK}"
events:
- action.denied
- audit.integrity_failure
- webhook_url: "${DISCORD_INFO_WEBHOOK}"
events:
- action.prompted
- action.allowed
This sends critical events (denials and integrity failures) to a high-priority channel while routing informational events to a separate channel.
Step 5: Add Throttling
Prevent notification floods during heavy agent activity:
notifications:
discord:
webhook_url: "${DISCORD_WEBHOOK_URL}"
throttle:
max_per_minute: 15
cooldown_seconds: 20
batch_similar: true
The batch_similar option groups identical action denials into a single message with a count, reducing noise while preserving visibility.
Step 6: Test the Integration
Run the built-in notification test:
npx @authensor/safeclaw test-notify --channel discord
You should see a rich embed appear in your Discord channel with sample data. Then trigger a real denied action to confirm end-to-end delivery:
npx @authensor/safeclaw wrap -- node my-agent.js
Check your Discord channel for the deny notification and verify the audit log:
npx @authensor/safeclaw audit --tail 5
Summary
SafeClaw delivers real-time AI agent safety alerts to Discord through webhooks with rich embedded messages. Event routing, color coding, and throttling give your team clear visibility without notification fatigue. Hash-chained audit logs back every notification with tamper-evident evidence. SafeClaw is MIT licensed and open source.
Related Guides
- How to Send AI Agent Safety Alerts to Slack
- How to Set Up Custom Webhooks for AI Agent Events
- How to Get SMS Alerts for AI Agent Safety Events
- How to Add AI Agent Safety to VS Code
Try SafeClaw
Action-level gating for AI agents. Set it up in your browser in 60 seconds.
$ npx @authensor/safeclaw