Webhooks
Rampart supports two types of webhooks:- Action webhooks - Delegate allow/deny decisions to external services
- Notification webhooks - Send alerts when policies trigger
Action Webhooks
Action webhooks delegate policy decisions to external HTTP endpoints. Use for LLM-based intent verification, Slack approval bots, or custom authorization logic.Basic Configuration
Webhook Schema
Webhook configuration object. Required when
action: webhook.Request Format
Rampart sends POST requests with this JSON payload:Request Fields
| Field | Type | Description |
|---|---|---|
tool | string | Tool type (exec, read, write, fetch, etc.) |
agent | string | Agent identity (e.g., claude-code, mcp-client) |
session | string | Session identifier (auto-detected as repo/branch from git) |
params | object | Tool-specific parameters (command, path, url, etc.) |
timestamp | string | ISO 8601 timestamp of the tool call |
policy_name | string | Name of the policy that triggered this webhook |
rule_index | integer | Zero-based index of the rule within the policy |
Tool-Specific Params
Response Format
Your webhook endpoint must return JSON with adecision field within the timeout period:
Allow or deny decision. Must be
"allow" or "deny".Optional explanation shown to the agent when denying.
Response Examples
Error Handling
| Error | Behavior with fail_open: true | Behavior with fail_open: false |
|---|---|---|
| Connection refused | Allow | Deny |
| Timeout | Allow | Deny |
| HTTP 500 | Allow | Deny |
| Invalid JSON | Allow | Deny |
Missing decision | Allow | Deny |
Invalid decision value | Allow | Deny |
Complete Example
Notification Webhooks
Notification webhooks send alerts to Slack, Discord, Microsoft Teams, or custom endpoints when policies trigger.Basic Configuration
Notify Schema
Top-level notification configuration. Optional.
Notification Payload
Rampart sends POST requests with this JSON payload:Platform-Specific Formatting
Rampart automatically formats payloads for each platform: Slack:Platform Setup
- Discord
- Slack
- Microsoft Teams
- In Discord, go to Server Settings → Integrations → Webhooks
- Click “New Webhook”
- Choose a channel and copy the webhook URL
- Add to your policy:
Complete Examples
Multi-Event Notifications
Deny-Only Notifications
Webhook Security
Action Webhooks
Use HTTPS
Always use HTTPS URLs for production webhooks to prevent interception.
Authenticate Requests
Your webhook endpoint should verify requests come from Rampart. Use a shared secret in a custom header:
Rate Limit
Add rate limiting to prevent abuse:
Notification Webhooks
Protect Webhook URLs
Webhook URLs act as authentication tokens. Don’t commit them to git. Use environment variables:
Rotate URLs Periodically
Regenerate webhook URLs every 90 days or when team members leave.
Validation Rules
Action Webhooks
webhook.urlmust be a valid HTTP/HTTPS URLwebhook.timeoutmust parse as a valid duration (e.g.,5s,100ms,1m)webhook.fail_openmust be boolean if present- Response must include
decisionfield with value"allow"or"deny"
Notification Webhooks
notify.urlmust be a valid HTTP/HTTPS URLnotify.onmust be a non-empty arraynotify.onvalues must be"deny","watch", or"ask"notify.platformmust be one of:auto,slack,discord,teams,openclaw,webhook
Reference Implementation
See rampart-verify for a complete webhook action implementation:- Flask server with
/verifyendpoint - LLM integration (OpenAI, Anthropic, Ollama)
- Rate limiting and authentication
- Structured logging
- Docker deployment
Next Steps
- Learn about Actions (deny, allow, watch, ask)
- Review Match Conditions for when clauses
- Explore Policy Structure for top-level schema