Push Notification Configuration

Push notifications help keep your app users informed by delivering real-time alerts for new messages, updates, or announcements, even when the app is closed or running in the background. This ensures continuous communication, timely re-engagement, and that users never miss important announcements or updates.

Setup Overview  

Upload push and VoIP certificates in the SalesIQ portal

To enable push and VoIP notifications in your iOS app using SalesIQ (Mobilisten), you must first generate valid .p12 certificates and upload them to the SalesIQ portal. This ensures notifications are sent securely to your app users.

Step 1: Generate .p12 Certificates

  • Log in to the Apple Developer Portal.
  • Go to Certificates, IDs & Profiles > Identifiers.
  • Create or select an explicit App ID (wildcards are not supported).
  • Enable the following capabilities:
    • Push Notifications
    • Voice over IP (VoIP) (under Background Modes > Voice over IP)
  • Navigate to Certificates and click ➕ to create new certificates:
    • For Push Notifications - Choose Apple Push Notification service SSL (Sandbox & Production)
    • For VoIP Notifications - Choose VoIP Services Certificate
  • For each certificate:
    • Generate and upload a Certificate Signing Request (CSR).
    • Download the resulting .cer file.
  • Open Keychain Access on your Mac:
    • Import the .cer file.
    • Right-click > Export → Save as .p12.
    • Set a secure password for each export, which is required in SalesIQ.

The .p12 certificates for Push Notifications and VoIP have been created successfully. 

Note: The .p12 certificate for VoIP is required only upon using MobilistenCalls.

Step 2: Upload certificate to SalesIQ portal

  • After generating the .p12 file, upload it to your SalesIQ account.
  • Log in to your Zoho SalesIQ account.
  • From your SalesIQ dashboard, navigate to Settings > Brands > Select your brand > Installation > iOS.
  • Scroll down to Configure push notification.
  • There will be two configuration blocks for APNs and VoIP.
  • Each block supports two environments:
    • Sandbox – for testing during development.
    • Production – for live app deployment.
  • For each applicable option (APNs and/or VoIP), upload the corresponding .p12 file for Sandbox and/or Production.
  • Enter the certificate password you used while exporting the .p12 from Keychain.
  • Click Save to apply the configuration.

Step 3: Test Push Notifications (Optional)

After uploading your certificate, you can test push delivery by registering your device and sending test messages from the SalesIQ portal.

Register your test device:

In your app, after obtaining the APNs device token:

Copied 
ZohoSalesIQ.enablePush(deviceTokenString, isTestDevice: true, mode: .sandbox)
  • deviceTokenString: From didRegisterForRemoteNotificationsWithDeviceToken.
  • isTestDevice: "true", marks the device for testing.
  • mode: Use .sandbox or .production based on your environment.

Send test notification:

  • In SalesIQ, navigate to the same Configure push notification > APNs > sandbox > Test push notification.
  • Enter a test message in the input field.
  • Click Send to deliver the push notification to registered test devices.

Note: If you remove a test device, it will no longer receive test messages, but regular notifications will continue working.

Set Up Notification Integration in the App

Once the APNs certificates are uploaded to the SalesIQ portal, the next step is to integrate notification support within your iOS app using the Mobilisten SDK. This includes, push notifications via APNs for chat messages and VoIP notifications for incoming audio calls. 

Note: The VoIP notification setup is only required if the MobilistenCalls framework is used for audio calling.

Add capabilities in Xcode

To enable Push and VoIP notifications in your app, add the appropriate capabilities in your Xcode project settings.

Step 1 - Push notification capability

  • Open your project in Xcode.
  • Select your target from the left sidebar.
  • Navigate to the Signing & Capabilities tab.
  • Click the + Capability button.
  • Search for Push Notifications and add it. 

This enables support for receiving remote notifications via APNs.

Step 2 - VoIP capability (for Audio Calling)

  • In the same Signing & Capabilities tab
  • Click + Capability again.
  • Search for  Background Modes and add it.
  • Under Background Modes, check Voice over IP and Background fetch. 

This allows your app to receive VoIP push notifications and wake the app when a call arrives.

Add notification handling in AppDelegate

Step 1 - Import required frameworks

To implement the notification support, ensure the necessary frameworks are imported into your AppDelegate.swift file.

Copiedimport UIKit                       // For App lifecycle and AppDelegate
import UserNotifications          // For APNs (push notifications)
import PushKit                    // For VoIP notifications via PushKit
import Mobilisten                 // For Zoho SalesIQ (chat & push)
import MobilistenCalls            // For audio calling & VoIP support

Note: Import MobilistenCalls only if your app includes audio call functionality.

Step 2 - Request authorization for Push & VoIP notifications

To enable notification support in your app, request permission from the user for standardpush notifications (APNs) and register for VoIP push notifications (PushKit). These registrations are triggered inside the AppDelegate during app launch.

 

Copiedclass AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        // Request permission for APNs Push Notifications
        self.requestAuthorization(application: application)

        // Register for VoIP Notifications (only if using audio calling)
        self.requestAuthorizationForVoip()

        return true
    }
}

Method 1 - Request Authorization for APNs

Copiedfunc requestAuthorization(application: UIApplication) {
    if #available(iOS 10.0, *) {
        let center = UNUserNotificationCenter.current()
        center.delegate = self

        center.requestAuthorization(options: [.badge, .alert, .sound]) { granted, error in
            print("Push permission granted: \(granted)")
        }

        // 🔸 Reply Action for Chat
        let reply = UNTextInputNotificationAction(
            identifier: "Reply",
            title: "Reply",
            options: [],
            textInputButtonTitle: "Send",
            textInputPlaceholder: "Message"
        )

        let chatCategory = UNNotificationCategory(
            identifier: "GRPCHATMSG",
            actions: [reply],
            intentIdentifiers: [],
            options: []
        )

        // 🔸 Accept/Decline for Call Invites
        let accept = UNNotificationAction(
            identifier: "Accept",
            title: "Accept",
            options: [.foreground]
        )

        let decline = UNNotificationAction(
            identifier: "Decline",
            title: "Decline",
            options: [.destructive]
        )

        let inviteCategory = UNNotificationCategory(
            identifier: "INVITE",
            actions: [accept, decline],
            intentIdentifiers: [],
            options: []
        )

        // 🔸 Register categories and APNs
        center.setNotificationCategories([chatCategory, inviteCategory])
        application.registerForRemoteNotifications()

    } else {
        let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
        application.registerUserNotificationSettings(settings)
    }
}

This method asks the user for permission to receive push notifications and registers the app with APNs.

Method 2 - Register for VoIP Push Notifications

Copiedfunc requestAuthorizationForVoip() {
    let voipRegistry = PKPushRegistry(queue: DispatchQueue.main)
    voipRegistry.desiredPushTypes = [.voIP]
    voipRegistry.delegate = self
}

This method registers your app to receive VoIP push using PushKit.

Note: Import MobilistenCalls only if your app includes audio call functionality.

Step 3 - Register device token & handle notification actions

After permission is granted, iOS provides a device token for push notifications. This must be registered with Zoho SalesIQ to deliver chat notifications to your app users. The user's actions from notifications, like replying to messages or accepting/declining call invites, can be handled as well.

Upload the APNs device token to SalesIQ

Copiedfunc application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let deviceTokenString = deviceToken.reduce("") { $0 + String(format: "%02X", $1) }

    // Upload the token to SalesIQ for push notifications
    ZohoSalesIQ.enablePush(deviceTokenString, isTestDevice: true, mode: .sandbox)
}

This method is called automatically by iOS once the device is successfully registered with APNs.

Note: Set isTestDevice: false and mode: .production for production builds.

Handle notification actions (e.g., Reply, Accept, Decline)

Copied@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter,
                            didReceive response: UNNotificationResponse,
                            withCompletionHandler completionHandler: @escaping () -> Void) {

    let userInfo = response.notification.request.content.userInfo
    let actionIdentifier = response.actionIdentifier
    let responseText = (response as? UNTextInputNotificationResponse)?.userText

    if ZohoSalesIQ.isMobilistenNotification(userInfo) {
        // Let SalesIQ handle the action (chat reply, call invite, etc.)
        ZohoSalesIQ.handlePushNotificationAction(
            actionIdentifier: actionIdentifier,
            userInfo: userInfo,
            responseText: responseText,
            completion: completionHandler
        )
    } else {
        // Handle any other non-SalesIQ notifications
        completionHandler()
    }
}

This delegate method handles any user interaction with actionable notifications, including text input replies or tapping buttons like "Accept" or "Decline." It supports both tap actions and inline replies for chat notifications and call invites.

Step 4 - Register VoIP token & handle incoming VoIP notifications

If your app supports audio calling using the MobilistenCalls framework, register the VoIP push token with SalesIQ and handle incoming VoIP notifications.

Register VoIP Token with SalesIQ

Copiedfunc pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
    let deviceTokenString = pushCredentials.token.reduce("") { $0 + String(format: "%02X", $1) }

    ZohoSalesIQCalls.enableVoIP(deviceTokenString, isTestDevice: true, mode: .sandbox)
}

This method is triggered when the VoIP token is received from Apple. Register it with ZohoSalesIQCalls so your app can receive incoming call notifications.

Note: Set isTestDevice: false and mode: .production for production builds.

Handle incoming VoIP notification

Copiedfunc pushRegistry(_ registry: PKPushRegistry,
                  didReceiveIncomingPushWith payload: PKPushPayload,
                  for type: PKPushType,
                  completion: @escaping () -> Void) {
    
    if ZohoSalesIQ.isMobilistenNotification(payload.dictionaryPayload) {
        ZohoSalesIQCalls.handleVOIPNotificationAction(payload.dictionaryPayload, completion: completion)
    } else {
        // Handle other VoIP notifications if needed
        completion()
    }
}

This method handles the incoming VoIP push payload and triggers the call UI.

Reference:

The updated AppDelegate.swift file with Push Notification and VoIP configuration methods is available for reference. Download, unzip, and refer to the implementation inside the file by clicking the below button. 

Download Sample APK