Developer Docs | Kommunicate

Developer Docs | Kommunicate

  • Book a Demo
  • Try For Free

›iOS

Web

  • Installation
  • CMS Installation
  • Authentication
  • Conversation
  • Conversation Assignment
  • Customization
  • Localization
  • Logout
  • Troubleshooting

Android

  • Installation
  • Authentication
  • Push Notification
  • Conversation
  • Customization
  • Localization
  • Logout
  • Migration
  • Troubleshooting

iOS

  • Installation
  • Authentication
  • Push Notification
  • Conversation
  • Customization
  • Configuration
  • Localization
  • Logout
  • Troubleshooting

React Native

  • Installation
  • Expo Installation
  • Authentication
  • Push Notification
  • Conversation
  • Customization
  • Logout
  • Troubleshooting

Flutter Mobile

  • Installation
  • Authentication
  • Push Notification
  • Conversation
  • Customization
  • Localization
  • Troubleshooting

Flutter Web

  • Installation
  • Authentication
  • Conversation

Ionic/Cordova

  • Installation
  • Authentication
  • Push Notification
  • Conversation
  • Customization
  • Localization
  • Logout
  • Resolving Errors

Ionic/Capacitor

  • Installation
  • Authentication
  • Push notification
  • Customization

Rich Messages

  • How To Use
  • Types of Rich Messages

Bots

  • Bot setup
  • Dialogflow Integration
  • Lex Integration
  • Kompose Bot Builder
  • IBM Watson Integration
  • Custom Bot Integration
  • Import Kompose Bot
  • Bot Samples

Integrations

  • Zapier
  • WhatsApp
  • WhatsApp 360Dialog
  • WhatsApp Twilio
  • WhatsApp Cloud API
  • Instagram Integration
  • Telegram Integration
  • Sunshine Integration
  • Freshdesk Integration
  • Pipedrive Integration
  • Agile Integration

Platform APIs

  • Authentication
  • Endpoints

Dashboard Features

  • Analytics
  • Conversations
  • Users
  • Bot Integration
  • Helpcenter
  • Campaign Messaging
  • Settings

Configuration

  • Single Sign On (SSO) Setup
  • Webhooks
  • Access Token URL
  • Email Fallback

Push Notification

Push Notification Setup

Add import statement in AppDelegate file to access the methods

import Kommunicate

Send device token to Kommunicate server:

In your AppDelegate’s didRegisterForRemoteNotificationsWithDeviceToken method send device token registration to Kommunicate server after you get deviceToken from APNS. Sample code is as below:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)
{

    print("DEVICE_TOKEN_DATA :: \(deviceToken.description)")  // (SWIFT = 3) : TOKEN PARSING

    var deviceTokenString: String = ""
    for i in 0..<deviceToken.count
    {
        deviceTokenString += String(format: "%02.2hhx", deviceToken[i] as CVarArg)
    }
    print("DEVICE_TOKEN_STRING :: \(deviceTokenString)")

    if (KMUserDefaultHandler.getApnDeviceToken() != deviceTokenString)
    {
        let kmRegisterUserClientService: KMRegisterUserClientService = KMRegisterUserClientService()
        kmRegisterUserClientService.updateApnDeviceToken(withCompletion: deviceTokenString, withCompletion: { (response, error) in
            print ("REGISTRATION_RESPONSE :: \(String(describing: response))")
        })
    }
}

Receive push notification:

Once your app receives notification, pass it to Kommunicate handler for chat notification processing.

Add the following code in AppDelegate class, this function will be called after the app launch to register for push notifications.

func registerForNotification() {
    UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in
        if granted {
            DispatchQueue.main.async {
                UIApplication.shared.registerForRemoteNotifications()
            }
        }
    }
}

/// Add below lines inside didFinishLaunchingWithOptions method

    UNUserNotificationCenter.current().delegate = self
    registerForNotification()

    KMPushNotificationHandler.shared.dataConnectionNotificationHandlerWith(Kommunicate.defaultConfiguration, Kommunicate.kmConversationViewConfiguration)
    let kmApplocalNotificationHandler: KMAppLocalNotification =  KMAppLocalNotification.appLocalNotificationHandler()
    kmApplocalNotificationHandler.dataConnectionNotificationHandler()

Handle app launch on notification click

Add the following code anywhere inside the AppDelegate class, refer to this sample for the better understanding.

func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
    let service = KMPushNotificationService()
    let dict = notification.request.content.userInfo
    guard !service.isKommunicateNotification(dict) else {
        service.processPushNotification(dict, appState: UIApplication.shared.applicationState)
        completionHandler([])
        return
    }
    completionHandler([.sound, .badge, .alert])
}

func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
    let service = KMPushNotificationService()
    let dict = response.notification.request.content.userInfo
    if service.isApplozicNotification(dict) {
        service.processPushNotification(dict, appState: UIApplication.shared.applicationState)
    }
    completionHandler()
}

AppDelegate changes for foreground notification:

The following functions will be called by AppDelegate when the app comes to foreground(active) mode, add this anywhere inside the AppDelegate class.

An optional step that is only required if you want to reset the app icon badge count after a user opens the app.

func applicationWillEnterForeground(_ application: UIApplication) {
    print("APP_ENTER_IN_FOREGROUND")
    UIApplication.shared.applicationIconBadgeNumber = 0
}

Save Context when app terminates:

 func applicationWillTerminate(application: UIApplication) {
     KMDBHandler.sharedInstance().saveContext()
 }

You can check the sample AppDelegate file here.

Certificates

a) Upload development and distribution APNs certificates

Upload development and distribution APNs certificates on Kommunicate dashboard, this will allow Kommunicate to send the notification for new messages to your mobile app.

APNS_Upload_Certificate.png

b) Updating Capabilities

Post setting up APNs, the next step is to enable “Push Notifications” and “Background Modes” within your project.

  1. Click on your project, select it from TARGETS.

  2. Next select ‘Signing & Capabilities’ section.

    • Click on “+Capability”

    • Search and select “Push Notifications”

    • Click on “+Capability” again

    • Search and select “Background Modes”

Enable “Background Fetch” and “Remote notifications” under “Background Modes” list

Following screenshot would be of help.

pushnotification_capabilities

← AuthenticationConversation →
  • Push Notification Setup
    • Send device token to Kommunicate server:
    • Receive push notification:
    • Handle app launch on notification click
    • AppDelegate changes for foreground notification:
    • Save Context when app terminates:
  • Certificates

Ready to automate more than 80% of your customer support?

Try for Free
  • support@kommunicate.io
  • United States
    (+1) (310) 402-2374
  • India
    (+91) 974-057-0196
  • Learn
    • iOS Chatbot
    • Amazon Lex Chatbot
    • Chatbot in Android
    • ChatGPT with Flutter
    • Document to Chatbot
    • React Native Chatbot
    • Create Flutter Chatbot
    • Whatsapp Business API
    • Integrate React Js Chatbot
    • Whatsapp Chatbot Using NodeJs
    • Integrate ChatGPT With Whatsapp
    • Integrate Dialogflow With Whatsapp
    • ChatGPT For Product Engagement
    • Product
    • AI Chatbot Builder
    • Generative AI Chatbot
    • Customer Experience
    • Chatbot Features
    • Dialogflow Integration
    • FAQ Chatbot
    • Live Chat
      Industries
    • Healthcare Chatbot
    • E-commerce Chatbot
    • Education Chatbot
    • Banking Chatbot
  • Integrations
    • E-commerce Chatbot Integration
    • Omnichannel Chatbot
    • Chatbot Integration
    • Chatbot for Website
    • Mobile Apps Chatbot
    • Chatbot for CRM's
    • Automation and Analytics
    • Zendesk Chatbot Integration
  • Resources
    • Chatbots Templates
    • Case Studies
    • Whitepapers
    • Chatbot Guide
    • Videos
    • Knowledge Hub
    • Comparisons
    • ROI Calculator
    • Blogs
    • Company
    • Partner Program
    • Affiliate Program
    • Pricing
    • About Us
    • Media
      Support
    • Contact Us
    • HelpCenter
    • Stack Overflow
    • API Status
  • Comapare
    • Kommunicate Vs Verloop
    • Kommunicate Vs Intercom
    • Kommunicate Vs Yellow
    • Kommunicate Vs Twak
    • Kommunicate Vs Ada
Arabic
Hindi
Spanish
French
German
Portuguese
Urdu
Software Advice Frontrunners for Live Chat Mar-22Software Advice Frontrunners for Live Chat Mar-22crozdesk badgeISO certificationHIPAA complianceGDPR compliant - GDPR Copy 12Created with Sketch.COMPLIANT
Copyright © 2025 Kommunicate.io.
T&C Privacy Policy Career SLA DPA Sitemap