From 73af1a4c6d1afa05fff7a87ad304fde47c6f20c4 Mon Sep 17 00:00:00 2001 From: Aaryan Rawat Date: Tue, 26 May 2026 11:30:53 +0530 Subject: [PATCH] docs(webhooks): Add campaign events documentation --- fundamentals/webhooks-overview.mdx | 17 + fundamentals/webhooks.mdx | 3 + .../management-apis/webhooks/overview.mdx | 406 ++++++++++++++++++ 3 files changed, 426 insertions(+) diff --git a/fundamentals/webhooks-overview.mdx b/fundamentals/webhooks-overview.mdx index 5006f91c5..184619b43 100644 --- a/fundamentals/webhooks-overview.mdx +++ b/fundamentals/webhooks-overview.mdx @@ -155,4 +155,21 @@ CometChat supports webhook triggers for different categories of events. Click ea *** +### Campaign Events + +| Event | Description | +| ----------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| [after\_campaign\_completed](/fundamentals/webhooks#after_campaign_completed) | Triggered when a campaign finishes sending to all targets. | +| [after\_campaign\_failed](/fundamentals/webhooks#after_campaign_failed) | Triggered when a campaign fails to deliver to its targets. | +| [after\_notification\_created](/fundamentals/webhooks#after_notification_created) | Triggered when a notification is created and begins dispatching. | +| [after\_feed\_item\_sent](/fundamentals/webhooks#after_feed_item_sent) | Triggered when an in-app feed item is sent to a user. | +| [after\_feed\_item\_delivered](/fundamentals/webhooks#after_feed_item_delivered) | Triggered when a feed item is delivered to the user's device. | +| [after\_feed\_item\_read](/fundamentals/webhooks#after_feed_item_read) | Triggered when a user reads a feed item. | +| [after\_feed\_item\_interacted](/fundamentals/webhooks#after_feed_item_interacted) | Triggered when a user interacts with a feed item. | +| [after\_push\_notification\_sent](/fundamentals/webhooks#after_push_notification_sent) | Triggered when a push notification is sent. | +| [after\_push\_notification\_delivered](/fundamentals/webhooks#after_push_notification_delivered) | Triggered when a push notification is delivered to the user's device. | +| [after\_push\_notification\_clicked](/fundamentals/webhooks#after_push_notification_clicked) | Triggered when a user clicks on a push notification. | + +*** + By following this guide, you can seamlessly integrate CometChat webhooks into your system and build event-driven experiences at scale. diff --git a/fundamentals/webhooks.mdx b/fundamentals/webhooks.mdx index c8e1e6fd2..80dbdae3c 100644 --- a/fundamentals/webhooks.mdx +++ b/fundamentals/webhooks.mdx @@ -39,6 +39,9 @@ Notifications for voice/video call events including initiation, start, end, part ### Moderation Events Notifications for content moderation outcomes including auto-approved, auto-blocked, and manually approved messages. +### Campaign Events +Notifications for campaign lifecycle events including campaign completion, failure, notification creation, feed item delivery (sent, delivered, read, interacted), and push notification delivery (sent, delivered, clicked). + ## Webhook Requirements Your webhook endpoint must: diff --git a/rest-api/management-apis/webhooks/overview.mdx b/rest-api/management-apis/webhooks/overview.mdx index 061f378ea..657e4da1e 100644 --- a/rest-api/management-apis/webhooks/overview.mdx +++ b/rest-api/management-apis/webhooks/overview.mdx @@ -79,6 +79,17 @@ Here is the list of properties associated with Webhook. | [`meeting_participant_left`](#meeting_participant_left) | The hook triggers when a participant leaves the meeting. | | [`meeting_ended`](#meeting_ended) | The hook triggers when the meeting is ended. | | [`recording_generated`](#recording_generated) | The hook triggers when the recording is generated. | +| [`after_campaign_completed`](#after_campaign_completed) | The hook triggers when a campaign finishes sending to all targets. | +| [`after_campaign_failed`](#after_campaign_failed) | The hook triggers when a campaign fails to deliver to its targets. | +| [`after_notification_created`](#after_notification_created) | The hook triggers when a notification is created and begins dispatching. | +| [`after_feed_item_sent`](#after_feed_item_sent) | The hook triggers when an in-app feed item is sent to a user. | +| [`after_feed_item_delivered`](#after_feed_item_delivered) | The hook triggers when a feed item is delivered to the user's device. | +| [`after_feed_item_read`](#after_feed_item_read) | The hook triggers when a user reads a feed item. | +| [`after_feed_item_interacted`](#after_feed_item_interacted) | The hook triggers when a user interacts with a feed item. | +| [`after_push_notification_sent`](#after_push_notification_sent) | The hook triggers when a push notification is sent. | +| [`after_push_notification_delivered`](#after_push_notification_delivered) | The hook triggers when a push notification is delivered to the user's device. | +| [`after_push_notification_clicked`](#after_push_notification_clicked) | The hook triggers when a user clicks on a push notification. | + ### Payload structure of events @@ -1194,3 +1205,398 @@ Here is the list of properties associated with Webhook. ``` + + +#### Campaigns + +##### after\_campaign\_completed: + + + +```json after_campaign_completed +{ + "trigger": "after_campaign_completed", + "data": { + "campaignId": "", + "appId": "", + "name": "Welcome Campaign", + "status": "completed", + "templateId": "", + "templateVersion": 1, + "totalTargets": 100, + "sentCount": 100, + "failedCount": 0, + "tag": "onboarding", + "scheduledAt": 1696930000, + "sentAt": 1696932000, + "completedAt": 1696932060, + "createdAt": 1696929000, + "updatedAt": 1696932060 + }, + "appId": "", + "region": "", + "webhook": "" +} +``` + + + +##### after\_campaign\_failed: + + + +```json after_campaign_failed +{ + "trigger": "after_campaign_failed", + "data": { + "campaignId": "", + "appId": "", + "name": "Promo Campaign", + "status": "failed", + "templateId": "", + "templateVersion": 1, + "totalTargets": 50, + "sentCount": 0, + "failedCount": 50, + "tag": "promo", + "scheduledAt": 1696930000, + "sentAt": 1696932000, + "completedAt": 1696932070, + "createdAt": 1696929000, + "updatedAt": 1696932070 + }, + "appId": "", + "region": "", + "webhook": "" +} +``` + + + +##### after\_notification\_created: + + + +```json after_notification_created +{ + "trigger": "after_notification_created", + "data": { + "notificationId": "", + "appId": "", + "templateId": "", + "templateVersion": 1, + "category": "updates", + "label": "weekly-digest", + "tags": ["digest", "weekly"], + "sendMode": "realtime", + "campaignId": "", + "priority": "normal", + "channels": ["in_app"], + "dataType": "ui_template", + "status": "dispatching", + "totalTargets": 3, + "sentCount": 0, + "failedCount": 0, + "createdAt": 1696932000 + }, + "appId": "", + "region": "", + "webhook": "" +} +``` + + + +##### after\_feed\_item\_sent: + + + +```json after_feed_item_sent +{ + "trigger": "after_feed_item_sent", + "data": { + "id": "", + "appId": "", + "notificationId": "", + "campaignId": "", + "receiver": "cometchat-uid-1", + "templateId": "", + "templateVersion": 1, + "channelType": "in_app", + "channelId": "", + "templateCategory": "promotions", + "categoryId": "", + "label": "promo", + "tags": ["offer", "summer"], + "alternativeText": "You have a new offer!", + "dataType": "ui_template", + "status": "sent", + "sentAt": 1696932000, + "deliveredAt": null, + "readAt": null, + "engagedAt": null, + "realtimeFanout": ["websocket"], + "content": { + "version": "1.0", + "body": [ + {"id": "el_1", "type": "text", "content": "Hello!", "variant": "heading2"}, + {"id": "el_2", "type": "divider"}, + {"id": "el_3", "type": "text", "content": "Your notification message here.", "variant": "body"} + ], + "style": { + "background": {"light": "#E8E8E8", "dark": "#E8E8E8"}, + "borderRadius": 16, + "borderColor": {"light": "#DFE6E9", "dark": "#DFE6E9"}, + "padding": 12 + } + } + }, + "appId": "", + "region": "", + "webhook": "" +} +``` + + + +##### after\_feed\_item\_delivered: + + + +```json after_feed_item_delivered +{ + "trigger": "after_feed_item_delivered", + "data": { + "id": "", + "appId": "", + "notificationId": "", + "campaignId": "", + "receiver": "cometchat-uid-1", + "templateId": "", + "templateVersion": 1, + "channelType": "in_app", + "channelId": "", + "templateCategory": "promotions", + "categoryId": "", + "label": "promo", + "tags": ["offer", "summer"], + "alternativeText": "You have a new offer!", + "dataType": "ui_template", + "status": "delivered", + "sentAt": 1696932000, + "deliveredAt": 1696932060, + "readAt": null, + "engagedAt": 1696932055, + "realtimeFanout": ["websocket"] + }, + "appId": "", + "region": "", + "webhook": "" +} +``` + + + +##### after\_feed\_item\_read: + + + +```json after_feed_item_read +{ + "trigger": "after_feed_item_read", + "data": { + "id": "", + "appId": "", + "notificationId": "", + "campaignId": "", + "receiver": "cometchat-uid-1", + "templateId": "", + "templateVersion": 1, + "channelType": "in_app", + "channelId": "", + "templateCategory": "promotions", + "categoryId": "", + "label": "promo", + "tags": ["offer", "summer"], + "alternativeText": "You have a new offer!", + "dataType": "ui_template", + "variables": {}, + "status": "read", + "sentAt": 1696932000, + "deliveredAt": 1696932060, + "readAt": 1696932120, + "engagedAt": null, + "metadata": {}, + "realtimeFanout": ["websocket"] + }, + "appId": "", + "region": "", + "webhook": "" +} +``` + + + +##### after\_feed\_item\_interacted: + + + +```json after_feed_item_interacted +{ + "trigger": "after_feed_item_interacted", + "data": { + "id": "", + "appId": "", + "notificationId": "", + "campaignId": "", + "receiver": "cometchat-uid-1", + "templateId": "", + "templateVersion": 1, + "channelType": "in_app", + "channelId": "", + "templateCategory": "promotions", + "categoryId": "", + "label": "promo", + "tags": ["offer", "summer"], + "alternativeText": "You have a new offer!", + "dataType": "ui_template", + "variables": {}, + "status": "read", + "sentAt": 1696932000, + "deliveredAt": 1696932060, + "readAt": 1696932120, + "interactedAt": 1696932180, + "metadata": {}, + "realtimeFanout": ["websocket"] + }, + "appId": "", + "region": "", + "webhook": "" +} +``` + + + +##### after\_push\_notification\_sent: + + + +```json after_push_notification_sent +{ + "trigger": "after_push_notification_sent", + "data": { + "pushNotificationId": "", + "appId": "", + "notificationId": "", + "campaignId": "", + "receiver": "cometchat-uid-1", + "templateId": "", + "templateVersion": 1, + "channelType": "push", + "channelId": "", + "category": "promotions", + "label": "summer-sale", + "tags": ["offer", "summer"], + "alternativeText": "Check out our summer sale!", + "dataType": "ui_template", + "variables": {}, + "status": "sent", + "sentAt": 1696932000, + "deliveredAt": null, + "clickedAt": null, + "engagedAt": null, + "failedAt": null, + "errorMessage": null, + "tag": "promo", + "metadata": {} + }, + "appId": "", + "region": "", + "webhook": "" +} +``` + + + +##### after\_push\_notification\_delivered: + + + +```json after_push_notification_delivered +{ + "trigger": "after_push_notification_delivered", + "data": { + "pushNotificationId": "", + "appId": "", + "notificationId": "", + "campaignId": "", + "receiver": "cometchat-uid-1", + "templateId": "", + "templateVersion": 1, + "channelType": "push", + "channelId": "", + "category": "promotions", + "label": "summer-sale", + "tags": ["offer", "summer"], + "alternativeText": "Check out our summer sale!", + "dataType": "ui_template", + "variables": {}, + "status": "delivered", + "sentAt": 1696932000, + "deliveredAt": 1696932005, + "clickedAt": null, + "engagedAt": null, + "failedAt": null, + "errorMessage": null, + "tag": "promo" + }, + "appId": "", + "region": "", + "webhook": "" +} +``` + + + +##### after\_push\_notification\_clicked: + + + +```json after_push_notification_clicked +{ + "trigger": "after_push_notification_clicked", + "data": { + "pushNotificationId": "", + "appId": "", + "notificationId": "", + "campaignId": "", + "receiver": "cometchat-uid-1", + "templateId": "", + "templateVersion": 1, + "channelType": "push", + "channelId": "", + "category": "promotions", + "label": "summer-sale", + "tags": ["offer", "summer"], + "alternativeText": "Check out our summer sale!", + "dataType": "ui_template", + "variables": {}, + "status": "clicked", + "sentAt": 1696932000, + "deliveredAt": 1696932005, + "clickedAt": 1696932060, + "engagedAt": null, + "failedAt": null, + "errorMessage": null, + "tag": "promo", + "metadata": {} + }, + "appId": "", + "region": "", + "webhook": "" +} +``` + + + +