" \| escape }} → `<div>` |
| `strip` | Removes leading and trailing whitespace. | \{\{ " Clix " \| strip }} → `Clix` |
| `replace` | Replaces all occurrences of a substring. | \{\{ "hello world" \| replace: "world", "Clix" }} → `hello Clix` |
### Chaining Filters
Filters can be applied in sequence:
```liquid theme={null}
{{ user.username | default: "Guest" | upcase }}
```
The `default` filter runs first, then the result is converted to uppercase.
***
## Full Example
### Event Payload
```json theme={null}
{
"name": "run_completed",
"properties": {
"distance": 7.4,
"elapsedTime": 2320
},
"user": {
"username": "Alex"
}
}
```
### API Trigger Example with Custom Properties
```json theme={null}
{
"audience": {
"broadcast": true
},
"properties": {
"promotion": "Holiday Sale",
"discount": "30%"
}
}
```
### Message Title (Event Example)
```liquid theme={null}
{% if event.distance >= 10 %}
Long run completed! 💪
{% else %}
Good run today!
{% endif %}
```
### Message Body (Event Example)
```liquid theme={null}
Hi {{ user.username }}, you ran {{ event.distance }} miles in {{ event.elapsedTime }} seconds.
```
### Deep Link (Event Example)
```
myapp://run/summary?distance={{ event.distance }}&time={{ event.elapsedTime }}
```
### Message Body (API Trigger Example)
With the API trigger properties above (`promotion` and `discount`), personalize your message using the `trigger` namespace:
```liquid theme={null}
🎉 {{ trigger.promotion }} is here! Get {{ trigger.discount }} off now!
```
Result: `🎉 Holiday Sale is here! Get 30% off now!`
***
## Best Practices
* Use simple, serializable data types (numbers, strings, booleans).
* Pre-format data (e.g., `"7.4 miles"`, `"38m 40s"`) before sending, then reference it directly.
* Add guards for missing data.
* Keep logic minimal. Complex branching belongs in your app or segmentation setup, not inside message templates.
***
## Error Handling
* Unknown variables render as an empty string.
* Invalid conditions evaluate to `false`.
* Template rendering errors appear in **Message Logs** with error details.
# iOS Notification Service Extension
Source: https://docs.clix.so/sdk-ios-nse
Guide for adding iOS Notification Service Extension to hybrid apps (React Native, Flutter) to support rich push notifications and push reception event tracking.
## Overview
**This guide is only for hybrid apps using React Native or Flutter.**
If you are developing a native iOS app, please refer to the [SDK Quickstart - iOS](/sdk-quickstart-ios) guide.
For hybrid apps built with React Native or Flutter, you must install an iOS-specific Notification Service Extension (NSE) to enable the following features:
* **Rich push notifications with images**
* **Push reception event tracking and analytics**
A Notification Service Extension is a native iOS extension that allows you to
modify notification content or download images before the notification is
displayed to the user.
## Prerequisites
### Environment
* Xcode 16.2 or later
* CocoaPods or Swift Package Manager
* Access to your React Native or Flutter project's iOS folder
[Make sure you've completed the Firebase setup.](/firebase-setting)
Verify that the following items are in place:
1. GoogleService-Info.plist is included in your iOS project
2. Service Account Key file is uploaded to the Clix console
## Installation Guide
Add the necessary capability to enable your app to receive push notifications.
1. Select your **main app target** in Xcode.
2. Navigate to the **Signing & Capabilities** tab.
3. Click the **+ Capability** button in the top-left corner.
4. Find and add **Push Notifications** from the list.
If you see "Push Notifications" in the Capabilities tab, you're all set!
Create a Notification Service Extension to handle image downloads and event tracking.
1. In Xcode, go to **File > New > Target**.
2. Select **Notification Service Extension** from the template list and click **Next**.
3. Enter a name for your extension (e.g., `ClixNotificationExtension`).
4. Click **Finish**.
5. When the "Activate scheme?" dialog appears, select **Cancel**.
After creation, you'll see a new folder and a `NotificationService.swift` file added to your project.
Add the Clix SDK to your Notification Service Extension so it can use Clix functionality.
**For React Native users**: React Native projects do not support Swift Package Manager (SPM). You must use CocoaPods (Option 2).
### Option 1) Using Swift Package Manager (SPM)
1. Open your iOS project (`.xcodeproj` or `.xcworkspace`) in Xcode.
2. Go to **File > Add Package Dependencies** from the menu.
3. Enter the following URL in the search field:
```
https://github.com/clix-so/clix-ios-sdk.git
```
4. Click **Add Package** to add the package.
5. **Important**: Select only your **extension target** (e.g., ClixNotificationExtension) to install. Do NOT select the main app target.
***
### Option 2) Using CocoaPods
1. Open your `Podfile` in your iOS project root.
2. Add ClixSDK **only to the extension target**:
```ruby Podfile theme={null}
target 'YourMainApp' do
# Firebase and other main app dependencies...
# DO NOT add ClixSDK here
end
target 'ClixNotificationExtension' do
pod 'Clix'
end
```
3. Run the following command in your terminal:
If you encounter any build errors, please refer to the [Troubleshooting](#troubleshooting) section below for common issues and solutions. We recommend to go through all solutions before you build the project.
```bash theme={null}
cd ios
pod install
```
If you're using CocoaPods, make sure to open the `.xcworkspace` file for all subsequent steps.
Configure App Groups to enable data sharing between your main app and the extension.
### Add App Groups to Main App Target
1. Select your **main app target**.
2. Go to the **Signing & Capabilities** tab.
3. Click the **+ Capability** button.
4. Find and add **App Groups**.
5. Click the **+** button in the App Groups section.
6. Create an App Group ID using the following format:
**The App Group ID must follow this exact format:**
```
group.clix.YOUR_APP_BUNDLE_ID
```
Replace `YOUR_APP_BUNDLE_ID` with your actual Clix project ID, which can be found in the Clix Console **Settings** page.
### Add Same App Groups to Extension Target
1. Select your **extension target** (e.g., ClixNotificationExtension).
2. Navigate to the **Signing & Capabilities** tab.
3. Click **+ Capability** and add **App Groups**.
4. Check the same App Group ID that you created for the main app.
Both your main app and extension targets must share the same App Group ID.
Modify the `NotificationService.swift` file in your extension with the following code:
Replace `YOUR_APP_BUNDLE_ID` with your actual app identifier.
```swift NotificationService.swift theme={null}
import Clix
import UserNotifications
/// NotificationService inherits all logic from ClixNotificationServiceExtension
/// No additional logic is needed unless you want to customize notification handling.
class NotificationService: ClixNotificationServiceExtension {
// Initialize with your Clix project ID
override init() {
super.init()
// Register your Clix project ID
register(projectId: YOUR_PROJECT_ID)
}
override func didReceive(
_ request: UNNotificationRequest,
withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void
) {
// Call super to handle image downloading and send push received event
super.didReceive(request, withContentHandler: contentHandler)
}
override func serviceExtensionTimeWillExpire() {
super.serviceExtensionTimeWillExpire()
}
}
```
`ClixNotificationServiceExtension` automatically handles:
* Downloading images from push notification payloads
* Sending push reception events to the Clix server
* Modifying and displaying notification content
Now that setup is complete, let's test your implementation.
### 1. Build Your Project
If you encounter any build errors, please refer to the [Troubleshooting](#troubleshooting) section below for common issues and solutions.
1. Select your main app scheme in Xcode.
2. Run **Product > Build** (⌘+B) to ensure there are no build errors.
3. Install the app on a real iOS device (simulators cannot receive push notifications).
### 2. Test Push Notifications
1. Launch the app and grant push notification permissions.
2. Navigate to the **Test Console** page in the Clix Console.
3. Find and select your registered device.
4. Send a test push message with an image.
5. Verify that the notification with the image is received on your device.
### 3. Verify Event Tracking
1. Open the real-time events panel in the Clix Console.
2. Check that "Push Received" events are being recorded in real-time when you receive push notifications.
If you see rich push notifications with images and push reception events are logged in the console, your installation is complete!
## Troubleshooting
When you add a Notification Service Extension (regardless of Clix installation), you may encounter build conflicts with RN-Firebase.
**Error symptom:**
* Build fails during the Embed Foundation Extensions phase
* Conflicts with \[RNFB] Core Configuration
**Solution:**
1. In Xcode, select your main app target.
2. Go to the **Build Phases** tab.
3. Find the **Embed Foundation Extensions** phase.
4. Drag it **above** the **\[RNFB] Core Configuration** phase.
This ensures that the extension is embedded before RN-Firebase's configuration runs.
**Reference:** [OneSignal Issue #1569](https://github.com/OneSignal/react-native-onesignal/issues/1569)
When you add a Notification Service Extension, Xcode automatically modifies the `project.pbxproj` file. If the `objectVersion` changes, you may encounter errors during `pod install` depending on your CocoaPods version and Xcode version.
**Error symptom:**
* `pod install` fails with version-related errors
* Error messages about incompatible project format
**Solution:**
1. Open your project in Xcode.
2. Select the project (root level) in the project navigator.
3. In the **File Inspector** (right panel), find **Project Format**.
4. Change the Xcode version to match your current Xcode installation.
5. Save and run `pod install` again.
**Reference:** [CocoaPods Issue #12840](https://github.com/CocoaPods/CocoaPods/issues/12840)
After installing Clix, you may see an error during the **\[CP] Embed Pods Frameworks** build phase. This occurs because CocoaPods tries to copy dependencies to the NSE target but lacks file write permissions.
**Error symptom:**
* Build fails at \[CP] Embed Pods Frameworks phase
* Permission denied errors when copying frameworks to the extension
**Root cause:**
In Xcode 15 and later, when you create a Notification Service Extension, the `ENABLE_USER_SCRIPT_SANDBOXING` build setting defaults to `YES`, which restricts script permissions.
**Solution:**
1. Select your **NSE target** (e.g., ClixNotificationExtension) in Xcode.
2. Go to **Build Settings**.
3. Search for `ENABLE_USER_SCRIPT_SANDBOXING`.
4. Set it to **No**.
5. Clean and rebuild your project.
**Reference:** [CocoaPods Issue #11946](https://github.com/CocoaPods/CocoaPods/issues/11946)
* Verify that the Clix SDK is properly added to the extension target. - Check
that the App Group ID is identical in both the main app and extension targets.
* Ensure that you're calling `super.didReceive` in
`NotificationService.swift`. - Verify that the push payload contains a valid
image URL.
* Verify that you've entered the correct project ID in the
`register(projectId:)` method. - Check that the device is connected to the
internet. - Review the Xcode console for any error logs.
* Try restarting Xcode and running Clean Build Folder (⌘+Shift+K).
* If using CocoaPods, run `pod install` again.
* If using Swift Package Manager, go to **File > Packages > Reset Package Caches**.
## Additional Resources
If you need to set up Firebase initially, refer to this guide.
Check out the SDK source code and sample projects.
Complete setup guide for React Native projects.
Complete setup guide for Flutter projects.
# SDK Quickstart - Android
Source: https://docs.clix.so/sdk-quickstart-android
Start sending your first notification in 10 minutes.
## Before Getting Started
### Overview
Clix leverages Firebase Cloud Messaging (FCM) to deliver notifications efficiently. The goal is to ensure a smooth integration process and reliable delivery of push notifications to your app users.
### Environment
* Android API level 26 (Android 8.0) or later
* Firebase account
[**Make sure you've completed the Firebase setup.**](/firebase-setting)
If the setup is complete, the following items should be in place:
* Make sure google-services.json is in your project directory.
* Upload the Service Account Key file to the Clix console.
## Setup Clix - Using CLI (Recommended)
Clix CLI is an AI-powered assistant for quick and easy SDK setup.
Use the install and doctor commands to automatically configure the required code and settings.
#### Install Clix CLI
```bash npm theme={null}
npm install -g @clix-so/clix-cli
```
```bash shell theme={null}
curl -fsSL https://cli.clix.so/install.sh | bash
```
```bash homebrew theme={null}
brew tap clix-so/clix-cli && brew install clix
```
#### Run Install Command
The install command checks for required files and configurations, then guides you through the installation process with interactive prompts.
```bash theme={null}
clix install
```
### Doctor Command
The clix doctor command verifies that your Clix SDK setup is correct and provides guidance on fixing any issues.
```bash theme={null}
clix doctor
```
## Setup Clix - Manual Installation
Integrate Firebase and Clix to manage and send notifications effectively from
Clix console.
Clix Android SDK supports installation only via **Gradle (Kotlin DSL).**
#### (Option 1) Using Version Catalog (Recommended)
If you're using the Gradle Version Catalog (`libs.versions.toml`), follow the steps below for more consistent dependency management.
1. Add the version and library alias to `gradle/libs.versions.toml` (create the file if it doesn't exist):
```toml theme={null}
[versions]
clix-android-sdk = "1.X.X" # Replace with the latest SDK version
[libraries]
clix-android-sdk = { module = "so.clix:clix-android-sdk", version.ref = "clix-android-sdk" }
```
2. (Optional) If you use a custom catalog file name, adjust the accessor accordingly. If you're using the default (`libs`), no extra configuration is required.
3. In your app module's `build.gradle.kts`:
```kotlin theme={null}
dependencies {
// TOML alias: clix-android-sdk -> Gradle accessor: libs.clix.android.sdk
implementation(libs.clix.android.sdk)
}
```
> When Gradle generates accessors, hyphens (-) in the alias are converted to dots (.) resulting in `libs.clix.android.sdk`.
***
#### (Option 2) Without Version Catalog (Direct Declaration)
Add the following to your project's `settings.gradle.kts` or `build.gradle.kts`:
```kotlin theme={null}
repositories {
mavenCentral()
}
```
Add the dependency to your app's `build.gradle.kts`:
```kotlin theme={null}
dependencies {
implementation("so.clix:clix-android-sdk:1.X.X") // Replace with the latest SDK version
}
```
Lastly, add the plugin to your app's `build.gradle.kts`:
```kotlin theme={null}
plugins {
id("com.google.gms.google-services") version "4.X.X" // Replace with the latest version
}
```
Add this code to your `Application` class. The endpoint and logLevel parameters are optional. If your project doesn't have an `Application` class, refer to [this link](https://pushalert.co/documentation/android-app-push-notification/create-application-class-android-app) to add one.
```kotlin Application.kt lines highlight={9-15} theme={null}
import so.clix.core.Clix
import so.clix.core.ClixConfig
import so.clix.utils.logging.ClixLogLevel
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Clix.initialize(
this,
ClixConfig(
projectId = "YOUR_PROJECT_ID",
apiKey = "YOUR_API_KEY",
),
)
}
}
```
Add this code to your `Application` class, right after the `Clix.initialize` code.
```kotlin Application.kt lines highlight={18-23} theme={null}
import so.clix.core.Clix
import so.clix.core.ClixConfig
import so.clix.utils.logging.ClixLogLevel
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Clix.initialize(
this,
ClixConfig(
projectId = "YOUR_PROJECT_ID",
apiKey = "YOUR_API_KEY",
),
)
// STEP 2: Configure notification handling after initialization
// Note: autoRequestPermission defaults to false
Clix.Notification.configure(
autoRequestPermission = false, // Set to true to automatically request permission
autoHandleLandingURL = false // Set to true to automatically open landing URLs
)
}
}
```
By default, `autoRequestPermission` is set to `false`, which means the app will not automatically request push notification permission.
There are two options to implement the push notification permission flow:
#### (Option 1) Automatically request permission right after app launch
Simply set `autoRequestPermission` to `true`.
```kotlin Application.kt highlight={4} theme={null}
// STEP 2: Configure notification handling after initialization
// Note: autoRequestPermission defaults to false
Clix.Notification.configure(
autoRequestPermission = true, // Set to true to automatically request permission
autoHandleLandingURL = false // Set to true to automatically open landing URLs
)
```
#### (Option 2) Manually control when to show the permission prompt
If you want to request permission at a specific point in your app, leave it as `false` and call the following code when you're ready to request permission.
```kotlin MainActivity.kt lines highlight={8-12} theme={null}
import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.launch
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Call this code wherever you want to request permission from the user
lifecycleScope.launch {
val granted = Clix.Notification.requestPermission()
Clix.Notification.setPermissionGranted(granted)
}
}
}
```
Run your project to verify that the setup works correctly. Go to Clix console > Test Console, find the registered device, send a test push notification, and confirm that the message is received on the device. Also, make sure the push events are being tracked in real time.
If you're using an emulator, make sure it is started with **Cold Boot** to properly test push notification delivery. For more details, see [this guide](https://docs.clix.so/trouble-shooting/not-getting-push-notification#emulator-not-started-with-cold-boot).
You need to set up Firebase before you start integrating it into your
project.
If you’d like to see a working example, check out our sample project.
# SDK Quickstart - Flutter
Source: https://docs.clix.so/sdk-quickstart-flutter
Start sending your first notification in 10 minutes.
## Before Getting Started
### Overview
Clix leverages Firebase Cloud Messaging (FCM) to deliver notifications efficiently. The goal is to ensure a smooth integration process and reliable delivery of push notifications to your app users.
### Environment
* Flutter 3.0.0 or later
* Dart 2.17.0 or later
* iOS 14.0+ / Android API 21+
* Firebase configured in your Flutter app ([Firebase setup guide](https://firebase.google.com/docs/flutter/setup?platform=android)).
* We recommend using `flutterfire` for the installation.
[******Make sure you’ve completed the Firebase setup.******](/firebase-setting)
If the setup is complete, the following items should be in place.
1. Make sure GoogleService-Info.plist is in your project's ios > Runner directory and google-services.json is in your project's android > app > src directory.
2. Upload the Service Account Key file to the Clix console.
## Setup Clix - Manual Installation
Clix Flutter SDK only supports manual installation.
Add the Clix Flutter SDK dependency to your project's `pubspec.yaml`:
```yaml theme={null}
dependencies:
clix_flutter: ^0.0.1
firebase_core: ^3.6.0
firebase_messaging: ^15.1.3
```
Install dependencies:
```bash theme={null}
flutter pub get
```
Initialize Firebase and Clix in your app's entry point (`main.dart`):
```dart main.dart theme={null}
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:clix_flutter/clix_flutter.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
await Clix.initialize(const ClixConfig(
projectId: 'YOUR_PROJECT_ID',
apiKey: 'YOUR_PUBLIC_API_KEY',
));
runApp(MyApp());
}
```
Replace `YOUR_PROJECT_ID` and `YOUR_PUBLIC_API_KEY` accordingly.
To add Push Notification Capability,
1. Select your app target.
2. Go to the **Signing & Capabilities** tab.
3. Click the **+** button and choose **Push Notification** from the list.
4. Click the **+** button and choose **Background Modes** from the list.
5. Then check **'Remote notifications'**.
```bash theme={null}
flutter run
```
**Known Issue: iOS 26.0 Simulator**
Push notification token generation may fail on iOS 26.0 Simulator. If you encounter this issue, update to iOS 26.1 or later. See [Apple Developer Forums](https://developer.apple.com/forums/thread/797507) for details.
For more details, please refer to the README file on the clix-flutter-sdk GitHub repository.
## Next Steps
Complete the iOS setup by adding a Notification Service Extension to enable rich notifications with images and track delivery events.
Check out the latest guides and API for the Clix Flutter SDK.
You need to set up Firebase before you start integrating it into your project.
If you'd like to see a working example, check out our sample project.
# SDK Quickstart - iOS
Source: https://docs.clix.so/sdk-quickstart-ios
Start sending your first notification in 10 minutes.
## Before Getting Started
### Overview
Clix leverages Firebase Cloud Messaging (FCM) to deliver notifications efficiently. The goal is to ensure a smooth integration process and reliable delivery of push notifications to your app users.
### Environment
* iOS 15.0 or later
* Swift 5.5 or later
* Xcode 16.2 or later
* Cocoapods or Swift Package Manager
[******Make sure you’ve completed the Firebase setup.******](/firebase-setting)
If the setup is complete, the following items should be in place.
1. Make sure GoogleService-Info.plist is in your project directory.
2. Upload the Service Account Key file to the Clix console.
## Setup Clix - Using CLI (Recommended)
Clix CLI is an AI-powered assistant for quick and easy SDK setup.
Use the install and doctor commands to automatically configure the required code and settings. For iOS projects, follow the CLI prompts to add the necessary files and configurations.
#### Install Clix CLI
```bash npm theme={null}
npm install -g @clix-so/clix-cli
```
```bash shell theme={null}
curl -fsSL https://cli.clix.so/install.sh | bash
```
```bash homebrew theme={null}
brew tap clix-so/clix-cli && brew install clix
```
#### Run Install Command
The install command in the Clix CLI checks for required files and configurations, and provides appropriate installation guidance through prompts.
```bash theme={null}
clix install
```
### Doctor Command
The clix doctor command checks whether the necessary code and configuration for using the Clix SDK are properly set up, and provides guidance on how to fix any issues.
```bash theme={null}
clix doctor
```
## Setup Clix - Manual Installation
Integrate Firebase and Clix to manage and send notifications effectively from
Clix console.
Option1) Using Swift Package Manager (SPM):
* Go to 'File' > 'Add Package Dependencies'
* Search and add **'**[**https://github.com/clix-so/clix-ios-sdk.git**](https://github.com/clix-so/clix-ios-sdk.git)**'**
* Install the package and select your main app as a target.
***
Option2) Using Pod:
* Add these lines to your `Podfile`:
```bash {2} theme={null}
# Podfile
pod 'Clix'
```
* Then run:
```bash theme={null}
pod install
```
To add Push Notification Capability,
1. Select your app target.
2. Go to the **Signing & Capabilities** tab.
3. Click the **+** button and choose **Push Notification** from the list.
Add this code to `AppDelegate.swift` inside the `didFinishLaunchingWithOptions` method:
Ensure that your AppDelegate inherits from ClixAppDelegate.
```swift AppDelegate.swift {5,8,13,16-24,30} theme={null}
import UIKit
import Clix
import FirebaseCore
class AppDelegate: ClixAppDelegate {
// Set to true to auto-request push permissions on launch.
// Default is false - you must manually request permissions.
override var autoRequestPermission: Bool { true }
override func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
Task {
await Clix.initialize(
config: ClixConfig(
projectId: YOUR_PROJECT_ID,
apiKey: YOUR_PUBLIC_API_KEY,
// Optional parameters:
// endpoint: "https://api.clix.so",
// logLevel: .debug,
// extraHeaders: [:]
)
)
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
```
Run your project to verify the setup works correctly. Notifications should appear on your device as expected.
**Known Issue: iOS 26.0 Simulator**
Push notification token generation may fail on iOS 26.0 Simulator. If you encounter this issue, update to iOS 26.1 or later. See [Apple Developer Forums](https://developer.apple.com/forums/thread/797507) for details.
1. Create a Notification Service Extension to enhance your notification content.
2. In Xcode, choose **File > New > Target > Notification Service Extension**.
3. Name the extension **'ClixNotificationExtension'**.
1. Select your app target.
2. Go to the **Signing & Capabilities** tab.
3. Click the **+** button and choose App Groups from the list.
4. Click **+** under App Groups and create the App Group ID
**The App Group ID must follow this exact format:**
```bash {1} theme={null}
group.clix.YOUR_BUNDLE_ID
```
Replace `YOUR_BUNDLE_ID` with your actual app bundle identifier (e.g., `group.clix.com.yourcompany.yourapp`). This ensures MMKV can share data between your app and extensions.
5. Add the same App Group Id to the Extension target.
6. At the Extension target > 'General' > 'Frameworks, Libraries ...' , click '+' button and search and add 'Clix' to your extension target.
Add the following to your extension's `NotificationService.swift`:
Note that you have to replace YOUR\_PROJECT\_ID to your own project id. (Check out Clix Console > Setting)
```swift NotificationService.swift {6,11} theme={null}
import Clix
import UserNotifications
/// NotificationService inherits all logic from ClixNotificationServiceExtension
/// No additional logic is needed unless you want to customize notification handling.
class NotificationService: ClixNotificationServiceExtension {
// Initialize with your Clix project ID
override init() {
super.init()
// Register your Clix project ID
register(projectId: YOUR_PROJECT_ID)
}
override func didReceive(
_ request: UNNotificationRequest,
withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void
) {
// Call super to handle image downloading and send push received event
super.didReceive(request, withContentHandler: contentHandler)
}
override func serviceExtensionTimeWillExpire() {
super.serviceExtensionTimeWillExpire()
}
}
```
Run your project to verify the setup works correctly. Go to Clix console > Test Console, find the registered device, send a push message, and check if the message is received properly on the device. Also, make sure the push events are being tracked in real time.
By default, `autoRequestPermission` is set to `false`, meaning the SDK will NOT automatically request push notification permissions.
**Option 1: Enable Auto-Request**
Override `autoRequestPermission` in your AppDelegate to automatically request permissions on launch:
```swift {2} theme={null}
class AppDelegate: ClixAppDelegate {
override var autoRequestPermission: Bool { true }
// ... rest of your code
}
```
**Option 2: Manual Permission Request**
If you want to control when the permission prompt appears (e.g., after onboarding), keep the default and call:
```swift {1} theme={null}
Clix.Notification.requestPermission()
```
**Option 3: Native Permission Handling**
If you handle permissions natively, you must notify Clix of the permission status:
```swift {8} theme={null}
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
if let error = error {
print("Permission request error: \(error)")
return
}
// Notify Clix SDK about permission status
Clix.Notification.setPermissionGranted(granted)
if granted {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
}
```
If `autoRequestPermission` is `false` and you don't call `Clix.Notification.setPermissionGranted(_:)` after handling permissions natively, the Clix server won't know the user's permission status, which may affect campaign targeting.
## Post-installation Checklist
After installing and wiring the SDK, review the following critical points to
avoid subtle runtime issues and ensure Clix can manage push notifications
correctly.
```swift AppDelegate.swift (Correct Order) {5,7,13,16-26,30} theme={null}
import UIKit
import Clix
import FirebaseCore
class AppDelegate: ClixAppDelegate {
// Set to true to auto-request push permissions on launch (default: false)
override var autoRequestPermission: Bool { true }
override func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// 1. Always configure Firebase first
FirebaseApp.configure()
// 2. Then initialize Clix (async-safe)
Task {
await Clix.initialize(
config: ClixConfig(
projectId: YOUR_PROJECT_ID,
apiKey: YOUR_PUBLIC_API_KEY,
// Optional parameters:
// endpoint: "https://api.clix.so",
// logLevel: .debug,
// extraHeaders: [:]
)
)
}
// 3. Return super at the very end (lets Clix finalize delegates & observers)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
```
```swift AppDelegate.swift (Incorrect - Clix before Firebase) {1-2} theme={null}
FirebaseApp.configure() // ❌ Missing (or comes after Clix)
Task { await Clix.initialize(config: /* ... */) } // Will fail if Firebase not ready
```
```swift AppDelegate.swift (Incorrect - super called first) {2} theme={null}
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: ...) -> Bool {
let ok = super.application(application, didFinishLaunchingWithOptions: launchOptions) // ❌ super too early
FirebaseApp.configure()
Task { await Clix.initialize(config: /* ... */) }
return ok
}
```
```swift AppDelegate.swift (Incorrect - manual delegate assignments) {7-8} theme={null}
import FirebaseMessaging
import UserNotifications
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: ...) -> Bool {
FirebaseApp.configure()
// ❌ Remove these. ClixAppDelegate manages them internally.
UNUserNotificationCenter.current().delegate = self
Messaging.messaging().delegate = self
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
```
**Initialize Clix after FirebaseApp.configure()**
Reason: Clix relies on Firebase Messaging. If Firebase isn't configured
first, FCM token retrieval and registration can fail.
**Call super at the very end of each overridden lifecycle method inherited
from ClixAppDelegate / ClixNotificationServiceExtension**
Reason: Clix's super implementation finalizes delegate setup, event
tracking, and background handling. Calling it early can overwrite or miss
your custom logic; omitting it breaks internal hooks.
**Remove manual assignments to Messaging.messaging().delegate and
UNUserNotificationCenter.current().delegate**
Reason: Clix sets these delegates internally. Reassigning them can prevent
delivery receipts, media attachment handling, or token sync.
If you must implement your own delegate methods (e.g., for foreground
presentation), do it in your AppDelegate subclass but still avoid reassigning
the delegates. Clix forwards relevant delegate callbacks so your overrides
continue to work.
Need to confirm things are correct? Run
`clix doctor` again — it re-validates configuration and highlights missing steps.
### Quick Self-Test
1. Launch the app cold start: verify no console errors about FCM or missing projectId.
2. Send a test push: confirm receipt and event tracking in the Clix Console (real-time events panel).
3. Foreground push: ensure notification presentation logic still works without manual delegate assignments.
If any step fails, re-check the checklist above before deeper debugging.
You need to set up Firebase before you start integrating it into your
project.
If you'd like to see a working example, check out our sample project.
# SDK Quickstart - React Native
Source: https://docs.clix.so/sdk-quickstart-react-native
Start sending your first notification in 10 minutes.
## Before Getting Started
### Overview
This guide walks you through setting up the Clix SDK in a React Native project. It covers all required steps including installing dependencies, configuring Firebase, and initializing the SDK. By following this quickstart, you can send your first notification in just a few minutes. This guide supports both Expo and standard React Native CLI projects.
**Prerequisites**
1. Have a React Native project (Expo or React Native CLI)
2. Create or use an existing Firebase project in the Firebase Console
3. Note your Android package name and iOS bundle identifier
4. For Expo projects: Ensure you're using `expo-dev-client` with local development builds (not Expo Go)
## Install React Native Firebase
You can skip this step if you already integrate [React Native Firebase](https://rnfirebase.io/).
**Make sure your React Native Expo project is using expo-dev-client with a local development build (not the standard Expo Go app).**
This is required to enable platform-native features such as push notifications.
If your project isn't using expo-dev-client yet, run the following script to install it:
```bash theme={null}
npx expo install expo-dev-client
```
Add the core Firebase module:
```bash theme={null}
npx expo install @react-native-firebase/app @react-native-firebase/messaging expo-build-properties
```
From the Firebase console download:
* google-services.json (for Android)
* GoogleService-Info.plist (for iOS)
Place them in your project root, then add to app.json:
```json theme={null}
{
"expo": {
"plugins": [
"@react-native-firebase/app",
"@react-native-firebase/messaging",
[
"expo-build-properties",
{
"ios": {
"useFrameworks": "static"
},
"android": {
"extraMavenRepos": [
"../../node_modules/@notifee/react-native/android/libs"
]
}
}
]
],
"android": {
"package": "com.your.app",
"googleServicesFile": "./google-services.json"
},
"ios": {
"bundleIdentifier": "com.your.app",
"googleServicesFile": "./GoogleService-Info.plist",
"entitlements": {
"aps-environment": "production"
},
"infoPlist": {
"UIBackgroundModes": ["remote-notification"]
}
}
}
}
```
Apply native configuration:
```bash theme={null}
npx expo prebuild --clean
```
Install the core Firebase modules:
```bash theme={null}
npm install @react-native-firebase/app @react-native-firebase/messaging
# or
yarn add @react-native-firebase/app @react-native-firebase/messaging
```
**Add Firebase Configuration File**
Download `GoogleService-Info.plist` from Firebase Console and add it to your Xcode project.
**Update Podfile**
Ensure your `ios/Podfile` has the following configuration:
```ruby ios/Podfile theme={null}
platform :ios, '14.0'
# Add this line before the target block
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true
target 'YourAppName' do
# ... rest of your configuration
end
```
The `use_frameworks! :linkage => :static` configuration is required for proper integration with Firebase and Clix SDK dependencies.
**Install Pods**
```bash theme={null}
cd ios && pod install && cd ..
```
**Configure AppDelegate**
Add Firebase initialization code to your AppDelegate:
```swift ios/YourApp/AppDelegate.swift theme={null}
import UIKit
import Firebase // Add this import
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure() // Add this line
// ... rest of your code
return true
}
}
```
```objc ios/YourApp/AppDelegate.mm theme={null}
#import "AppDelegate.h"
#import // Add this import
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIRApp configure]; // Add this line
// ... rest of your code
return YES;
}
@end
```
**Enable Capabilities in Xcode**
1. Open your project in Xcode
2. Select your target → Signing & Capabilities
3. Add "Push Notifications" capability
4. Add "Background Modes" capability and enable "Remote notifications"
5. Add "App Groups" capability
6. Click the "+" button under App Groups and create a new App Group with identifier: `group.clix.YOUR_BUNDLE_ID`
The App Group identifier must follow the format `group.clix.{bundle_id}` (e.g., `group.clix.com.yourcompany.yourapp`). This ensures MMKV can share data between your app and extensions.
**Add Firebase Configuration File**
Download `google-services.json` from Firebase Console and place it in `android/app/`.
**Update build.gradle Files**
Add Google Services plugin to `android/build.gradle`:
```gradle theme={null}
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.15'
}
}
```
Apply the plugin in `android/app/build.gradle`:
```gradle theme={null}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
```
## Install Clix SDK
Add the Clix SDK and required dependencies:
```bash theme={null}
npx expo install @clix-so/react-native-sdk @notifee/react-native react-native-device-info react-native-get-random-values react-native-mmkv react-native-nitro-modules uuid@11.1.0
```
**Version Compatibility**
* React Native 0.70-0.73: Use `react-native-get-random-values` v1.11.0 and `react-native-mmkv` v2.12.2
* React Native 0.74+: Use `react-native-get-random-values` v1.12.0+ and `react-native-mmkv` v3.0.1+
* `react-native-nitro-modules` is required when using `react-native-mmkv` v3.0.1+
Add the Clix initialization code at the top of your `index.js` file:
```typescript theme={null}
import { AppRegistry } from 'react-native';
import { name as appName } from './app.json';
import App from './App';
import Clix, { ClixLogLevel } from '@clix-so/react-native-sdk';
import 'react-native-get-random-values';
// Initialize Clix SDK
Clix.initialize({
projectId: 'YOUR_PROJECT_ID',
apiKey: 'YOUR_API_KEY',
logLevel: ClixLogLevel.DEBUG, // Optional
}).then(() => {
// If you don't manually request push permission elsewhere,
// enable auto-request to prompt users automatically
Clix.Notification.configure({ autoRequestPermission: true });
});
AppRegistry.registerComponent(appName, () => App);
```
Apply native code and configuration:
**We recommend rebooting the simulator and reinstalling the app before running it again.**
```bash theme={null}
npx expo prebuild --clean
npx expo run:android
npx expo run:ios
```
**Known Issue: iOS 26.0 Simulator**
Push notification token generation may fail on iOS 26.0 Simulator. If you encounter this issue, update to iOS 26.1 or later. See [Apple Developer Forums](https://developer.apple.com/forums/thread/797507) for details.
Install the Clix SDK and required dependencies:
```bash theme={null}
npm install @clix-so/react-native-sdk @notifee/react-native react-native-device-info react-native-get-random-values@^1.11.0 react-native-mmkv react-native-nitro-modules uuid@11.1.0
# or
yarn add @clix-so/react-native-sdk @notifee/react-native react-native-device-info react-native-get-random-values@^1.11.0 react-native-mmkv react-native-nitro-modules uuid@11.1.0
```
**Version Compatibility**
* React Native 0.70-0.73: Use `react-native-get-random-values` v1.11.0 and `react-native-mmkv` v2.12.2
* React Native 0.74+: Use `react-native-get-random-values` v1.12.0+ and `react-native-mmkv` v3.0.1+
* `react-native-nitro-modules` is required when using `react-native-mmkv` v3.0.1+
Install the iOS dependencies:
```bash theme={null}
cd ios && pod install && cd ..
```
Add the Clix initialization code at the top of your `index.js` file:
```typescript theme={null}
import { AppRegistry } from 'react-native';
import { name as appName } from './app.json';
import App from './App';
import Clix, { ClixLogLevel } from '@clix-so/react-native-sdk';
import 'react-native-get-random-values';
// Initialize Clix SDK
Clix.initialize({
projectId: 'YOUR_PROJECT_ID',
apiKey: 'YOUR_API_KEY',
logLevel: ClixLogLevel.DEBUG, // Optional
}).then(() => {
// If you don't manually request push permission elsewhere,
// enable auto-request to prompt users automatically
Clix.Notification.configure({ autoRequestPermission: true });
});
AppRegistry.registerComponent(appName, () => App);
```
Run your application:
**iOS**
```bash theme={null}
npx react-native run-ios
```
**Android**
```bash theme={null}
npx react-native run-android
```
**We recommend cleaning and rebuilding if you encounter any issues:**
* iOS: Product → Clean Build Folder in Xcode
* Android: `cd android && ./gradlew clean && cd ..`
**Known Issue: iOS 26.0 Simulator**
Push notification token generation may fail on iOS 26.0 Simulator. If you encounter this issue, update to iOS 26.1 or later. See [Apple Developer Forums](https://developer.apple.com/forums/thread/797507) for details.
## Next Steps
Complete the iOS setup by adding a Notification Service Extension to enable
rich notifications with images and track delivery events.
# Security and Ops
Source: https://docs.clix.so/security/index
Overview of our security and operations docs.
Use these links for details:
* [RPO and RTO](/security/rpo-rto)
* [Resiliency testing](/security/resiliency-testing)
* [Customer responsibilities](/legal/customer-responsibilities)
* [Incident communication](/ops/incident-communication)
* [S3 access review](/ops/s3-access-review)
* [Data classification](/security/data-classification)
* [Compliance](/security/compliance)
# Errors
Source: https://docs.clix.so/troubleshooting/clix-server-errors
Troubleshooting errors you may face in Clix console.
**Cause:** There’s a mismatch between the Service Account and the client-side GoogleService-Info.plist (or google-services.json) configuration.
**Solution:** Make sure the service account file and the Google service files are from the same Firebase project.
**Cause:** The Clix server encountered an unexpected internal error.
**Solution:** Please try again, and if the issue persists, contact Clix support.
Make sure your App signing and Apple push keys (.p8 file) is correctly registered on the Firebase console.
This error often happens because of an invalid token. Here are the steps to check and fix the issue:
1. **Verify the Token**
Make sure the token used in the request is valid and not expired or malformed.
2. **Check Signing Process**
If you are generating a token manually, confirm that the signing process is correct. The algorithm, headers, and payload must follow the required format.
3. **Confirm p8 File or Certificate**
If you are using APNs with Firebase Cloud Messaging, ensure that the .p8 file or certificate is correctly uploaded in the Firebase console and matches the key ID and team ID used in your code.
4. **APNs Key and Bundle ID**
Make sure the APNs key is linked to the correct app, and the bundle ID used matches what is registered in Firebase and Apple Developer Console.
5. **Review Firebase Console Settings**
Double-check all related settings in the Firebase project. Any mismatch between Firebase and Apple credentials can cause this error.
By reviewing these points, you can usually identify the problem and adjust your request to fix the error.
**Cause:** The .p8 file is not uploaded to the Firebase console, or the uploaded file is invalid.
**Solution:** Upload a valid APNs authentication key (.p8 file) to your Firebase project. See [Firebase Setting Guide](https://docs.clix.so/firebase-setting#things-to-prepare) for detailed instructions.
# Notification Not Delivered to Device
Source: https://docs.clix.so/troubleshooting/not-getting-push-notification
Refer to the checklist below to troubleshoot issues with push notifications not being delivered.
The push notification was sent successfully but did not appear on the user’s device.
This issue may be caused by missing notification permissions, network restrictions, token expiration, or incorrect SDK integration.
## iOS
**Cause:** The Push Notification capability is not enabled in your Xcode project.
**Solution:**
1. Open your project in Xcode.
2. Navigate to your target's **Signing & Capabilities** tab.
3. Click the **+** button and add **Push Notifications** capability.
4. Rebuild and rerun your application.
**Cause:** The Xcode or simulator version you are using is outdated.
**Solution:**
1. Check your Xcode and Simulator versions.
2. Update Xcode and Simulator to the latest versions via the App Store or Xcode preferences.
3. Restart Xcode and Simulator after updating.
**Cause:** The user has not granted push notification permissions.
**Solution:**
1. On your device, navigate to **Settings** > **Notifications** > Your App.
2. Ensure **Allow Notifications** is enabled.
3. You can also confirm notification permission status in the Clix device list dashboard.
**Cause:** Your device has a poor or unstable network connection.
**Solution:**
1. Ensure your device has a stable internet connection.
2. Try switching between Wi-Fi and cellular data to improve connectivity.
3. Verify connectivity by visiting a webpage or using other network-dependent apps.
## Android
**Cause:** Your emulator device did not start with a cold boot.
**Solution:**
1. Open Android Studio Device Manager.
2. Select your emulator device, click on **Edit**.
3. Go to the **Additional Settings** section.
4. Set the **Boot option** to **Cold boot**.
5. Save changes and restart your emulator.
**Cause:** The user has not granted push notification permissions.
**Solution:**
1. Navigate to **Settings** > **Apps** > Your App > **Notifications**.
2. Ensure notification permissions are enabled.
3. Confirm permission status in the Clix device list dashboard.
**Cause:** Your device is experiencing poor or unstable network connectivity.
**Solution:**
1. Check your internet connection by opening a browser or another app.
2. Switch between Wi-Fi and mobile data to resolve connectivity issues.
3. Restart the device or emulator and try again.
# User Management
Source: https://docs.clix.so/user-management/user-management
User management in the Clix SDK allows you to distinguish between anonymous users and identified users within your app. This ensures that push notifications, in-app messaging, and analytics can be personalized and consistent across devices and sessions.
You can check how to use the API in the Clix SDK GitHub repositories for each platform:
* [iOS](https://github.com/clix-so/clix-ios-sdk#user-management)
* [Android](https://github.com/clix-so/clix-android-sdk#user-management)
* [React Native](https://github.com/clix-so/clix-react-native-sdk#user-management)
* [Flutter](https://github.com/clix-so/clix-flutter-sdk#user-management)
For additional conceptual details, see the [Clix Documentation on User](https://docs.clix.so/essentials/user).
If no user ID is set, Clix will automatically treat the user as **anonymous**
with only a device ID and an auto-generated `project-user-id`.
If a user ID is set, the anonymous user will be **converted** into an
**Identified User**, linking all their previous activity with their account.
## When to Use User Management
By default, when your app starts without setting a user ID, Clix assigns an
**anonymous profile**. This is useful when users are browsing your app
without logging in.
Once a user logs in or creates an account, you can call the **User
Management API** to assign a permanent `userId`. This converts the anonymous
user to an **Identified User**, ensuring continuity of notifications,
preferences, and analytics across devices.
When a user logs out, you don't need to take any action. Events after
logout are attributed to the last known user. Call `reset()` only if you
need to fully anonymize the user (e.g., shared devices).
***
## User Logout / Reset
By default, you don't need to handle logout explicitly. Events sent after logout are attributed to the last known user, which is sufficient for most use cases.
If you need to explicitly log users out or track events under an anonymous user (e.g., shared devices where multiple people sign in), call `reset()`. This anonymizes the user by:
* Setting the user ID to null
* Clearing the device ID so a new one is generated on next initialization
With an empty user ID and a completely new device ID, the current user appears as a brand new anonymous user in the dashboard. After calling `reset()`, you must call `initialize()` again before using the SDK.
```swift iOS theme={null}
// On logout
Clix.reset()
// On next login
Clix.initialize(config: config)
Clix.setUserId("user_12345")
```
```kotlin Android theme={null}
// On logout
Clix.reset()
// On next login
Clix.initialize(context, config)
Clix.setUserId("user_12345")
```
```typescript React Native theme={null}
// On logout
await Clix.reset();
// On next login
await Clix.initialize({ projectId: "...", apiKey: "..." });
await Clix.setUserId("user_12345");
```
```dart Flutter theme={null}
// On logout
await Clix.reset();
// On next login
await Clix.initialize(ClixConfig(projectId: "...", apiKey: "..."));
await Clix.setUserId("user_12345");
```
`removeUserId()` is deprecated. Use `reset()` instead.
***
## Example Usage
```swift theme={null}
// 1. Anonymous user (default)
// No userId is set, Clix generates a project-user-id internally
// 2. Identified user
// After login, set a unique userId
Clix.setUserId("clix_user")
```
## Setting User Properties
You can attach custom properties to a user profile for personalization and analytics. Properties can be strings, numbers, or booleans.
**Set a single property (async):**
```swift theme={null}
try await Clix.setUserProperty("subscription", value: "premium")
```
**Set multiple properties (async):**
```swift theme={null}
try await Clix.setUserProperties([
"age": 25,
"city": "Seoul",
"premium": true
])
```
**Set a single property (sync):**
```swift theme={null}
Clix.setUserProperty("subscription", value: "premium")
```
**Set multiple properties (sync):**
```swift theme={null}
Clix.setUserProperties([
"age": 25,
"city": "Seoul",
"premium": true
])
```
***
## Removing User Properties
You can remove one or more properties from a user profile.
**Remove a single property (async):**
```swift theme={null}
try await Clix.removeUserProperty("subscription")
```
**Remove multiple properties (async):**
```swift theme={null}
try await Clix.removeUserProperties(["age", "premium"])
```
**Remove a single property (sync):**
```swift theme={null}
Clix.removeUserProperty("subscription")
```
**Remove multiple properties (sync):**
```swift theme={null}
Clix.removeUserProperties(["age", "premium"])
```
***
## Error Handling
All user management operations can throw errors. Always handle errors for robust apps:
**Error handling example:**
```swift theme={null}
do {
try await Clix.setUserId("user123")
} catch {
print("Failed to set user ID: \(error)")
}
```