Overview
When an event occurs in Chatwoot (such as a new message or conversation status change), Chatwoot sends an HTTP POST request to your configured webhook URL with the event payload in JSON format.Creating a Webhook
Via API
Webhook Types
- Account-level webhooks (
webhook_type: 0): Receive events for all inboxes in the account - Inbox-level webhooks (
webhook_type: 1): Receive events only for a specific inbox
app/models/webhook.rb:27
Available Events
Chatwoot supports the following webhook events:| Event | Description |
|---|---|
conversation_created | New conversation is created |
conversation_status_changed | Conversation status changes (open, resolved, pending) |
conversation_updated | Conversation attributes are updated |
message_created | New message is created |
message_updated | Message is updated |
contact_created | New contact is created |
contact_updated | Contact attributes are updated |
inbox_created | New inbox is created |
inbox_updated | Inbox settings are updated |
conversation_typing_on | User starts typing |
conversation_typing_off | User stops typing |
webwidget_triggered | Widget is opened by a visitor |
app/models/webhook.rb:29-31
Webhook Payload Structure
Message Created Event
app/models/message.rb (webhook_data method)
Conversation Status Changed Event
app/listeners/webhook_listener.rb:2-8
Contact Created Event
app/models/contact.rb (webhook_data method)
Conversation Typing Events
app/listeners/webhook_listener.rb:96-108
Widget Triggered Event
app/listeners/webhook_listener.rb:45-52
Security
Webhook Signature Verification
Chatwoot webhooks are sent via HTTPS POST requests with a JSON payload. Currently, Chatwoot does not include HMAC signatures by default, but you should:- Use HTTPS URLs only - Webhook URLs must use HTTPS
- Validate the request origin - Check that requests come from your Chatwoot instance
- Implement IP allowlisting - Restrict webhook endpoint access to your Chatwoot server IP
- Use a secret token in the URL - Include a random token in your webhook URL path
Example: Verifying Webhook with Secret Token
Webhook Delivery
Timeout Configuration
Webhooks have a configurable timeout (default: 5 seconds). You can set a custom timeout using theWEBHOOK_TIMEOUT environment variable.
Source: lib/webhooks/trigger.rb:82-87
Retry Policy
Chatwoot does not automatically retry failed webhook deliveries. Your endpoint should:- Respond with a
200 OKstatus code quickly (within 5 seconds) - Process webhook data asynchronously if needed
- Implement idempotency to handle duplicate deliveries
Error Handling
For certain events (message_created, message_updated), webhook failures trigger automatic error handling:
- Agent Bot Webhooks: Failed delivery moves conversation from
pendingtoopenstatus - API Inbox Webhooks: Failed delivery marks the message with
failedstatus
lib/webhooks/trigger.rb:33-42
Testing Webhooks
Using RequestBin or Webhook.site
Local Testing with ngrok
Example Implementations
Node.js/Express
Python/Flask
Ruby/Sinatra
Managing Webhooks
List Webhooks
Update Webhook
Delete Webhook
Best Practices
- Process asynchronously: Return 200 OK immediately and process webhook data in a background job
- Implement idempotency: Use the event
idto prevent duplicate processing - Handle all events gracefully: Don’t fail on unexpected event types
- Log webhook payloads: Keep audit logs for debugging
- Monitor webhook health: Track delivery success rates and response times
- Use appropriate subscriptions: Only subscribe to events you need
- Implement exponential backoff: If you need to make external API calls
- Set up alerting: Monitor for webhook processing failures
Troubleshooting
Webhook Not Receiving Events
- Verify the webhook URL is accessible from your Chatwoot instance
- Check that the webhook subscriptions include the event type
- Ensure your endpoint returns a 200 status code within 5 seconds
- Check Chatwoot logs for delivery errors
Duplicate Events
- Implement idempotency using the event
idfield - Store processed event IDs in your database
Missing Data in Payload
- Different events have different payload structures
- Check the specific event documentation above
- Some fields may be
nulldepending on the event context
Related Resources
- Custom Attributes - Learn about custom attributes in webhook payloads
- Widget SDK - Trigger events that generate webhooks
- API Reference - Webhook management endpoints

