Overview
Webhooks allow LibreChat to send real-time notifications to external services when specific events occur. This enables integration with third-party systems, automation workflows, and custom event handling.Webhook support in LibreChat is currently limited. This page documents the webhook architecture and potential integration points. Check the LibreChat documentation for the latest webhook capabilities.
Webhook Events
LibreChat can potentially send webhooks for the following events:Conversation Events
conversation.created- New conversation startedconversation.updated- Conversation title or settings changedconversation.deleted- Conversation deletedconversation.archived- Conversation archived/unarchived
Message Events
message.created- New message sent (user or AI)message.updated- Message editedmessage.deleted- Message deletedmessage.feedback- Feedback added to message
User Events
user.registered- New user registereduser.login- User logged inuser.logout- User logged out
Agent Events
agent.created- New agent createdagent.updated- Agent configuration updatedagent.deleted- Agent deleted
File Events
file.uploaded- File uploadedfile.deleted- File deleted
Webhook Payload Format
Webhook payloads follow this general structure:Payload Fields
Event type identifier
ISO 8601 timestamp when the event occurred
Event-specific data payload
ID of the user who triggered the event
Unique identifier for this webhook delivery
Webhook Configuration
Webhooks can be configured via environment variables or configuration file:Environment Variables
Configuration File (librechat.yaml)
Security
Signature Verification
Webhook requests include anX-Webhook-Signature header for verification:
Headers
Webhook requests include:Content-Type: application/jsonX-Webhook-Signature: sha256=...X-Webhook-Event: message.createdX-Webhook-ID: webhook_abc123User-Agent: LibreChat-Webhooks/1.0
Handling Webhooks
Example Express.js webhook handler:Retry Logic
LibreChat will retry failed webhook deliveries:- Initial attempt: Immediate
- Retry 1: After 5 seconds
- Retry 2: After 15 seconds
- Retry 3: After 60 seconds
- HTTP status code is not 2xx
- Request times out (default 5 seconds)
- Connection error occurs
Rate Limiting
To prevent overwhelming your webhook endpoint:- Maximum 100 events per second per webhook
- Events may be batched if rate is exceeded
- Configure rate limits in
librechat.yaml:
Filtering Events
Filter events by user, conversation, or other criteria:Testing Webhooks
Use tools like:- Webhook.site: Test webhook deliveries
- ngrok: Expose local server for testing
- Postman: Mock webhook responses
Event Examples
Message Created
Conversation Created
User Registered
Use Cases
Analytics
Send conversation and message data to analytics platforms:Notifications
Send notifications to Slack, Discord, or email:Automation
Trigger workflows based on events:Logging
Log all events to external logging service:Limitations
- Webhooks are fire-and-forget (no response data used)
- Maximum payload size: 1MB
- Maximum retry attempts: 3
- Webhook URL must be HTTPS in production
Future Enhancements
Planned webhook features:- Webhook management UI
- Multiple webhook URLs per event
- Custom webhook transformations
- Webhook delivery logs and analytics
- Conditional webhooks with complex filters