Skip to main content

Documentation Index

Fetch the complete documentation index at: https://cometchat-22654f5b-docs-campaigns-service-rest-api.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Campaign webhook events are triggered during the lifecycle of campaigns, notifications, feed items, and push notifications. These events allow you to track delivery and engagement in real-time.
Campaign webhooks use the same webhook infrastructure as other CometChat webhooks. Configure your webhook endpoint in the Webhooks settings.

Event Types

TriggerDescription
after_campaign_completedCampaign finishes sending to all targets
after_campaign_failedCampaign fails to deliver to its targets
after_notification_createdNotification is created and begins dispatching
after_feed_item_sentIn-app feed item is sent to a user
after_feed_item_deliveredFeed item is delivered to the user’s device
after_feed_item_readUser reads a feed item
after_feed_item_interactedUser interacts with a feed item
after_push_notification_sentPush notification is sent
after_push_notification_deliveredPush notification is delivered to the user’s device
after_push_notification_clickedUser clicks on a push notification

Status Flow

Feed Items: sentdeliveredreadinteracted Push Notifications: sentdeliveredclicked Campaigns: dispatchingcompleted / failed

Campaign Events

after_campaign_completed

Triggered when a campaign finishes sending to all targets.
{
    "trigger": "after_campaign_completed",
    "data": {
        "campaignId": "<campaignId>",
        "appId": "<appId>",
        "name": "Welcome Campaign",
        "status": "completed",
        "templateId": "<templateId>",
        "templateVersion": 1,
        "totalTargets": 100,
        "sentCount": 100,
        "failedCount": 0,
        "tag": "onboarding",
        "scheduledAt": 1696930000,
        "sentAt": 1696932000,
        "completedAt": 1696932060,
        "createdAt": 1696929000,
        "updatedAt": 1696932060
    },
    "appId": "<appId>",
    "region": "<region>",
    "webhook": "<webhookID>"
}

after_campaign_failed

Triggered when a campaign fails to deliver to its targets.
{
    "trigger": "after_campaign_failed",
    "data": {
        "campaignId": "<campaignId>",
        "appId": "<appId>",
        "name": "Promo Campaign",
        "status": "failed",
        "templateId": "<templateId>",
        "templateVersion": 1,
        "totalTargets": 50,
        "sentCount": 0,
        "failedCount": 50,
        "tag": "promo",
        "scheduledAt": 1696930000,
        "sentAt": 1696932000,
        "completedAt": 1696932070,
        "createdAt": 1696929000,
        "updatedAt": 1696932070
    },
    "appId": "<appId>",
    "region": "<region>",
    "webhook": "<webhookID>"
}

Notification Events

after_notification_created

Triggered when a notification is created and begins dispatching.
{
    "trigger": "after_notification_created",
    "data": {
        "notificationId": "<notificationId>",
        "appId": "<appId>",
        "templateId": "<templateId>",
        "templateVersion": 1,
        "category": "updates",
        "label": "weekly-digest",
        "tags": ["digest", "weekly"],
        "sendMode": "realtime",
        "campaignId": "<campaignId>",
        "priority": "normal",
        "channels": ["in_app"],
        "dataType": "ui_template",
        "status": "dispatching",
        "totalTargets": 3,
        "sentCount": 0,
        "failedCount": 0,
        "createdAt": 1696932000
    },
    "appId": "<appId>",
    "region": "<region>",
    "webhook": "<webhookID>"
}

Feed Item Events

after_feed_item_sent

Triggered when an in-app feed item is sent to a user.
{
    "trigger": "after_feed_item_sent",
    "data": {
        "id": "<feedItemId>",
        "appId": "<appId>",
        "notificationId": "<notificationId>",
        "campaignId": "<campaignId>",
        "receiver": "cometchat-uid-1",
        "templateId": "<templateId>",
        "templateVersion": 1,
        "channelType": "in_app",
        "channelId": "<channelId>",
        "templateCategory": "promotions",
        "categoryId": "<categoryId>",
        "label": "promo",
        "tags": ["offer", "summer"],
        "alternativeText": "You have a new offer!",
        "dataType": "ui_template",
        "status": "sent",
        "sentAt": 1696932000,
        "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": "<appId>",
    "region": "<region>",
    "webhook": "<webhookID>"
}

after_feed_item_delivered

Triggered when a feed item is delivered to the user’s device.
{
    "trigger": "after_feed_item_delivered",
    "data": {
        "id": "<feedItemId>",
        "appId": "<appId>",
        "notificationId": "<notificationId>",
        "campaignId": "<campaignId>",
        "receiver": "cometchat-uid-1",
        "templateId": "<templateId>",
        "templateVersion": 1,
        "channelType": "in_app",
        "channelId": "<channelId>",
        "templateCategory": "promotions",
        "categoryId": "<categoryId>",
        "label": "promo",
        "tags": ["offer", "summer"],
        "alternativeText": "You have a new offer!",
        "dataType": "ui_template",
        "status": "delivered",
        "sentAt": 1696932000,
        "deliveredAt": 1696932060,
        "engagedAt": 1696932055,
        "realtimeFanout": ["websocket"]
    },
    "appId": "<appId>",
    "region": "<region>",
    "webhook": "<webhookID>"
}

after_feed_item_read

Triggered when a user reads a feed item.
{
    "trigger": "after_feed_item_read",
    "data": {
        "id": "<feedItemId>",
        "appId": "<appId>",
        "notificationId": "<notificationId>",
        "campaignId": "<campaignId>",
        "receiver": "cometchat-uid-1",
        "templateId": "<templateId>",
        "templateVersion": 1,
        "channelType": "in_app",
        "channelId": "<channelId>",
        "templateCategory": "promotions",
        "categoryId": "<categoryId>",
        "label": "promo",
        "tags": ["offer", "summer"],
        "alternativeText": "You have a new offer!",
        "dataType": "ui_template",
        "variables": {},
        "status": "read",
        "sentAt": 1696932000,
        "deliveredAt": 1696932060,
        "readAt": 1696932120,
        "metadata": {},
        "realtimeFanout": ["websocket"]
    },
    "appId": "<appId>",
    "region": "<region>",
    "webhook": "<webhookID>"
}

after_feed_item_interacted

Triggered when a user interacts with a feed item (e.g., clicks a button or link).
{
    "trigger": "after_feed_item_interacted",
    "data": {
        "id": "<feedItemId>",
        "appId": "<appId>",
        "notificationId": "<notificationId>",
        "campaignId": "<campaignId>",
        "receiver": "cometchat-uid-1",
        "templateId": "<templateId>",
        "templateVersion": 1,
        "channelType": "in_app",
        "channelId": "<channelId>",
        "templateCategory": "promotions",
        "categoryId": "<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": "<appId>",
    "region": "<region>",
    "webhook": "<webhookID>"
}

Push Notification Events

after_push_notification_sent

Triggered when a push notification is sent.
{
    "trigger": "after_push_notification_sent",
    "data": {
        "pushNotificationId": "<pushNotificationId>",
        "appId": "<appId>",
        "notificationId": "<notificationId>",
        "campaignId": "<campaignId>",
        "receiver": "cometchat-uid-1",
        "templateId": "<templateId>",
        "templateVersion": 1,
        "channelType": "push",
        "channelId": "<channelId>",
        "category": "promotions",
        "label": "summer-sale",
        "tags": ["offer", "summer"],
        "alternativeText": "Check out our summer sale!",
        "dataType": "ui_template",
        "variables": {},
        "status": "sent",
        "sentAt": 1696932000,
        "tag": "promo",
        "metadata": {}
    },
    "appId": "<appId>",
    "region": "<region>",
    "webhook": "<webhookID>"
}

after_push_notification_delivered

Triggered when a push notification is delivered to the user’s device.
{
    "trigger": "after_push_notification_delivered",
    "data": {
        "pushNotificationId": "<pushNotificationId>",
        "appId": "<appId>",
        "notificationId": "<notificationId>",
        "campaignId": "<campaignId>",
        "receiver": "cometchat-uid-1",
        "templateId": "<templateId>",
        "templateVersion": 1,
        "channelType": "push",
        "channelId": "<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,
        "tag": "promo"
    },
    "appId": "<appId>",
    "region": "<region>",
    "webhook": "<webhookID>"
}

after_push_notification_clicked

Triggered when a user clicks/taps on a push notification.
{
    "trigger": "after_push_notification_clicked",
    "data": {
        "pushNotificationId": "<pushNotificationId>",
        "appId": "<appId>",
        "notificationId": "<notificationId>",
        "campaignId": "<campaignId>",
        "receiver": "cometchat-uid-1",
        "templateId": "<templateId>",
        "templateVersion": 1,
        "channelType": "push",
        "channelId": "<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,
        "tag": "promo",
        "metadata": {}
    },
    "appId": "<appId>",
    "region": "<region>",
    "webhook": "<webhookID>"
}

Common Fields

FieldDescription
triggerThe event name
appIdYour CometChat app ID
regionThe region of the app
webhookThe webhook ID that received this event
data.campaignIdThe campaign this event belongs to (null if sent directly via API)
data.notificationIdUnique identifier for the notification batch
data.templateIdThe template used for this notification
data.templateVersionVersion of the template
data.receiverThe UID of the target user
data.channelTypeDelivery channel: in_app or push
data.channelIdThe channel configuration ID
data.statusCurrent status of the item
data.tagsCustom tags associated with the notification
data.labelCustom label for categorization
data.variablesTemplate variables resolved for the receiver
data.metadataCustom metadata attached to the notification