Before proceeding, ensure you have completed the UI Kit integration and the Dashboard Setup for Campaigns.
Overview
Campaigns delivers notifications as Card Schema JSON — a structured format that defines the visual layout of each notification card. The system consists of three layers:- CometChat Chat SDK — Fetches feed items, manages read/delivered state, provides real-time listeners, handles push notification tracking
- CometChat Cards Library — Renders Card Schema JSON into native UIKit views
- CometChat UI Kit — Provides the ready-to-use
CometChatNotificationFeedcomponent that wires everything together
Sending Campaigns
Before integrating the frontend, you need to set up channels, categories, templates, and campaigns in the CometChat Dashboard. Follow the Dashboard Setup Guide for step-by-step instructions with screenshots.How Cards Work
EachNotificationFeedItem from the SDK contains a content field — a [String: Any] dictionary holding the Card Schema JSON. This JSON is passed directly to the CometChat Cards renderer which produces a native UIKit view.
The Cards library is a pure renderer:
- Input: Card Schema JSON string + theme mode + optional action callback
- Output: Native UIKit view hierarchy
Card Schema JSON Example
Notification Feed Component
TheCometChatNotificationFeed component renders campaign notifications as a full-screen scrollable feed. It handles fetching, card rendering, pagination, filtering, real-time updates, and engagement reporting automatically.
- Swift
Setting Up Notification Service Extension
To track push notification delivery for campaigns, you need a Notification Service Extension. This runs when a push arrives on the device (even if the app is in the background).Step 1: Create the Extension
- In Xcode, go to File → New → Target.
- Select Notification Service Extension.
- Name it (e.g.,
NotificationService). - Click Finish.
Step 2: Configure App Groups
Both your main app and the extension need to share data via an App Group:- Select your main app target → Signing & Capabilities → + Capability → App Groups.
- Add a group (e.g.,
group.com.yourapp.cometchat). - Select your extension target → repeat the same steps with the same group ID.
Step 3: Add CometChatSDK to the Extension
The app target getsCometChatSDK through the UI Kit package, but that package’s only product is CometChatUIKitSwift, so the extension can’t link CometChatSDK from it. Link the chat SDK package to the extension directly:
- Go to File → Add Package Dependencies and enter
https://github.com/cometchat/chat-sdk-ios. - Select Up to Next Major Version from
4.2.1(the same floor the UI Kit declares, so SPM resolves one shared version). - Add the CometChatSDK product to the extension target only — not the app target, which already gets it from the UI Kit.
CometChatSDK pod stops at 4.1.10, older than the 4.2.1 the UI Kit resolves.
Step 4: Implement the Extension
- Swift
Handling Push Notification Clicks
When the user taps a campaign push notification, report the click and navigate to the feed:- Swift
Managing Campaigns
Campaigns are created and managed from the CometChat Dashboard or via the REST API. The SDK and UI Kit are consumer-side — they display and interact with campaigns, not create them.- Dashboard: Navigate to Campaigns → follow the flow above (Channel → Category → Template → Bubble Builder → Send).
- REST API: Use the Campaigns API to programmatically create and schedule campaigns.