POST /api/analytics/events Record an analytics event for a notification. Use this to track when notifications are delivered, viewed, or clicked by end users.

Headers

appid
string
required
Your CometChat App ID.
apikey
string
required
Your CometChat API Key.

Request body

campaignId
string
required
The campaign or notification ID associated with this event.
userId
string
required
The user ID who triggered the event.
channelType
string
required
Channel type: in_app, push, sms, email, whatsapp, or custom.
eventType
string
required
Event type: delivered, viewed, or clicked.

Example request

curl -X POST https://{appId}.api-{region}.cometchat.io/v3/business-messaging/api/analytics/events \
  -H "appid: YOUR_APP_ID" \
  -H "apikey: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignId": "666c3d4e5f6a7b8c9d0e1f2a",
    "userId": "user-jane-123",
    "channelType": "in_app",
    "eventType": "viewed"
  }'

Example response

{
  "success": true,
  "eventId": "evt_xyz789"
}

Response fields

success
boolean
Whether the event was recorded.
eventId
string
Unique identifier for the recorded event.
Events are idempotent — recording the same event type for the same user and campaign multiple times does not create duplicate entries.