Skip to main content
Complete guide to implementing push notifications with Zixflow using Apple Push Notifications (APNs) or Firebase Cloud Messaging (FCM).
Track your campaigns: With autoTrackPushEvents(true), the SDK tracks body opened. Action-button taps are not auto-tracked. Campaigns can be Native (aps.alert OS-rendered) or Custom (top-level display keys + mutable-content: 1 for NSE). Zixflow always sends Zixflow-Delivery-ID and Zixflow-Delivery-Token, plus routing keys (deeplink_url, action_buttons, template_id). Payloads: Push Notification Tracking.

Prerequisites

  1. Add push credentials (APNs or FCM) in the Zixflow dashboard
  2. Enable Push Notifications capability in Xcode
  3. Install the push module:
    • ZixflowMessagingPushAPN for APNs
    • ZixflowMessagingPushFCM for FCM
Test on a physical device — the simulator cannot receive remote push.

Apple Push Notifications (APNs)

Step 1: Enable Push Notifications in Xcode

  1. Select your project in Xcode
  2. Go to TargetSigning & Capabilities
  3. Click + CapabilityPush Notifications
  4. Click + CapabilityBackground Modes → enable Remote notifications

Step 2: Initialize core SDK and MessagingPushAPN

Match the iOS example: plain AppDelegate + UNUserNotificationCenterDelegate for action buttons.
With autoTrackPushEvents(true), body taps (UNNotificationDefaultActionIdentifier) are tracked as Opened. Action-button taps still need your didReceive handler.
MessagingPushConfigBuilder options

Step 3: Identify users

Device tokens are associated with a profile when you call identify():

Step 4: Rich push with Notification Service Extension

  1. FileNewTargetNotification Service Extension
  2. Add ZixflowMessagingPushAPN to the extension target
  3. Share an App Group between the app and extension (group.{bundleId}.zixflow)
CocoaPods extension target:
NotificationService.swift:
Set the same appGroupId when initializing push in the main app:

Step 5: Manual device token registration (optional)

If you disable autoFetchDeviceToken, forward the APNs token via MessagingPush.shared:

Firebase Cloud Messaging (FCM)

Step 1: Firebase project

  1. Create/select a project in the Firebase console
  2. Add your iOS app and download GoogleService-Info.plist into the Xcode project

Step 2: Install dependencies

Step 3: Initialize Firebase, Zixflow, and push

Configure Firebase first, then initialize Zixflow and the push module. Forward FCM registration tokens to Zixflow:
Advanced: MessagingPushFCM.internalSetup(withConfig:firebaseService:) accepts a FirebaseService adapter for automatic APNs↔FCM token bridging. Most apps can use MessagingPush.initialize plus registerDeviceToken(fcmToken:) as shown above.

Step 4: FCM Notification Service Extension


Zixflow sends deeplink_url for body taps and per-button deeplink values inside action_buttons. Route them in didReceive. The iOS example reads those official keys:
Optional: SDKConfigBuilder.deepLinkCallback for other SDK-forwarded URLs. Full property contract and action sample: Push Notification Tracking.

Custom Action Buttons

Named action buttons are not auto-registered by the SDK. Parse the official action_buttons payload key and pre-register a notification category. The sample app uses category ZX_2BTN with action identifiers ACTION_0 and ACTION_1.

Payload format

If you want buttons, parse the official action_buttons key. The sample app expects a JSON-encoded string:
Parsed structure:

Register ZX_2BTN at launch

Register categories in application(_:didFinishLaunchingWithOptions:) (or equivalent startup):
Rules:
  • Maximum 2 buttons per notification (iOS system limit)
  • Button index is 0-based (leftmost = index 0)
  • Pre-registered titles can be generic (Action 1, Action 2); campaign button names are tracked via action_name
  • deeplink may be empty — handle that case in your navigation code
  • The SDK does not auto-register categories — the app must call setNotificationCategories
For open + action-click tracking (including property names), see Push Notification Tracking.

Template-based custom rendering (template_id)

Every push sent from a dashboard template includes template_id. On iOS, apply template-specific customization in the Notification Service Extension. Full pattern: Template-Based Custom Rendering.

Manual metrics

Body opens are covered by autoTrackPushEvents(true). For action buttons (and any custom path), call:
Read delivery fields from Zixflow-Delivery-ID / ZIXFLOW-Delivery-ID and the matching token keys. See Push Notification Tracking.

Delete device token

Troubleshooting

Enable .logLevel(.debug) while integrating.