Legacy Webhooks Overview
CometChat legacy webhooks enable real-time event-driven communication with your system. They allow you to receive HTTP POST requests whenever specific events occur—such as sending a message or a user coming online. These webhooks are ideal for integrating external services like SMS, email, analytics, or auditing systems.
Webhook Endpoint Requirements
To ensure reliable delivery and security, your webhook endpoint must meet the following requirements:
- HTTPS Required: Your endpoint must use
HTTPS
to ensure secure data transmission. - Public Accessibility: It must be accessible from the public internet.
- Support for POST Requests: The endpoint must accept
HTTP POST
requests with aContent-Type
ofapplication/json
. - Immediate Acknowledgment: Your server must respond with an
HTTP 200 OK
status quickly to acknowledge receipt.
Security
It is strongly recommended to use Basic Authentication to protect your webhook endpoints.
Header Format
When enabled, every webhook request from CometChat will include the following HTTP header:
Authorization: Basic <Base64-encoded-credentials>
Set your username and password while configuring the webhook on the CometChat dashboard.
Webhook Triggers
Below are the legacy webhook events supported by CometChat:
Message Events
These events are triggered during the lifecycle of a message.
Event | Description |
---|---|
before_message | Triggered when a message is in-flight—just before it is processed by CometChat. |
after_message | Triggered after a message has been successfully sent. |
message_delivery_receipt | Triggered when a message is marked as delivered to a user. |
message_read_receipt | Triggered when a message is marked as read by the recipient. |
User Events
These events relate to changes in user presence status.
Event | Description |
---|---|
user_connection_status_change | Triggered when a user connects or disconnects from the CometChat platform. |
Next Steps: