Skip to main content

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:

  1. HTTPS Required: Your endpoint must use HTTPS to ensure secure data transmission.
  2. Public Accessibility: It must be accessible from the public internet.
  3. Support for POST Requests: The endpoint must accept HTTP POST requests with a Content-Type of application/json.
  4. 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.

EventDescription
before_messageTriggered when a message is in-flight—just before it is processed by CometChat.
after_messageTriggered after a message has been successfully sent.
message_delivery_receiptTriggered when a message is marked as delivered to a user.
message_read_receiptTriggered when a message is marked as read by the recipient.

User Events​

These events relate to changes in user presence status.

EventDescription
user_connection_status_changeTriggered when a user connects or disconnects from the CometChat platform.

Next Steps: