Overview
Webhooks deliver real-time event notifications to your application via HTTP POST requests. Use them to react to payments, policy violations, agent status changes, and x402 session events.
Setting Up Webhooks
Via SDK
Via API
Event Types
Webhook Payload
Every webhook delivery includes a JSON payload with this structure:
Signature Verification
Every webhook delivery includes a signature header for verification. Always verify signatures before processing webhook events.
How It Works
AgentWallex signs each webhook payload using the secret you provided at registration. The signature is sent in the X-AgentWallex-Signature header.
Verification Example
Always use constant-time comparison (e.g., timingSafeEqual or hmac.compare_digest) when verifying signatures to prevent timing attacks.
Testing Webhooks
Send a test event to your webhook endpoint:
Viewing Deliveries
Check the delivery history for a webhook:
Managing Webhooks
Best Practices
Respond to webhook deliveries with a 2xx status code within 5 seconds. If your handler needs to do heavy processing, acknowledge the webhook immediately and process asynchronously.
- Always verify signatures before processing events.
- Handle duplicates — Webhook deliveries may be retried. Use the
id field for idempotency.
- Return 200 quickly — Acknowledge receipt before doing heavy processing.
- Monitor delivery failures — Check the deliveries endpoint for failed deliveries.
- Use specific event filters — Subscribe only to the events you need rather than receiving all events.