Developer Docs | Kommunicate

Developer Docs | Kommunicate

  • Docs

›Android

Web

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

Android

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

iOS

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

React Native

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

Flutter

  • Installation
  • Authentication
  • Customization
  • Conversation
  • Push Notification

Ionic/Cordova/Phonegap

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

Rich Messages

  • How To Use
  • Types of Rich Messages

Bots

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

Integrations

  • Zapier

Platform APIs

  • Authentication
  • Endpoints

Dashboard Features

  • Analytics

Configuration

  • Email Fallback
  • Webhooks
  • Access Token URL

Push Notification

Overview

You can set up push notifications to notify your end users for incoming chat messages. For managing push notifications, you must have a Firebase account.

Note: If you already have a Firebase account and code to retrieve firebase registration token for the client app instance, then skip this section and move to Push notification setup section.

1) Get the google-services.json file

  1. If you haven't already added firebase to your project, add Firebase to your Android project

  2. Once you're done with above setup, download the google-services.json file from firebase console, click Settings icon -> Project settings -> General -> Scroll to bottom -> Select your app -> Click the google-services.json button.

firebase_fcm_1.png

  1. Place the google-services.json file under the root directory of your app.

2) Obtain server key from firebase

  1. From firebase console, click Settings icon -> Project settings

  2. Once you clicked project settings select Cloud Messaging tab under Settings. Under Project Credentials, copy your Server Key which is highlighted blue in the following image.

firebase_fcm_2.png

Note: Make sure you copy the Server key and not the Legacy key or Sender ID.

3) Add your server key to Kommunicate

Go to Push notification section in Kommunicate dashboard and update the FCM server key under the 'GCM/FCM Key' section. You can find it in the Settings -> Cloud Messaging -> Server Key section of your Firebase console.

4) Gradle file configuration

  1. Open your project level(root level) build.gradle file and under buildscript node, add the below classpath inside dependencies:
 classpath 'com.google.gms:google-services:3.1.1'
  1. Open your app level build.gradle and at the bottom of the file apply the plugin as below:
apply plugin: 'com.google.gms.google-services'

If you do not have any push notification setup, kommunicate will do it internally for you. If you already have the setup, follow the next section.

Already have the push notification setup?

If you already have the push notification setup, follow the below steps.

1) Send the device token to Kommunicate

The first step in the setup would be to send the deviceToken to Kommunicate. This needs to be done in onNewToken method of your FirebaseMessagingService subclass. The onNewToken method is called whenever firebase updates the deviceToken on that device.

Note: onNewToken method provides registrationId, this is the deviceToken.

Use the below code to send the token to Kommunicate.

Kommunicate.updateDeviceToken(context, registrationId);

2) Receive push notifications

For Receiving FCM Notifications in your app, add the following code in your FirebaseMessagingService inside onMessageReceived(RemoteMessage remoteMessage):

if (Kommunicate.isKmNotification(this, remoteMessage.getData())) {
    return;
}

Set notification small icon

To set the notification small icon, place the below metadata in your AndroidManifest.xml file under </application> tag :

 <meta-data 
    android:name="com.applozic.mobicomkit.notification.smallIcon"
    android:resource="<YOUR_LAUNCHER_SMALL_ICON>" /> <!-- Replace this with a valid resource name for Launcher white Icon -->

Note: Android version 6.0 onwards, android automatcially converts the small icon color to monochrome. While some custom ROM devices do show colored icons, it is recommended that you use a shaped icon with some transparent background instead of round solid icons as a small icon.

← AuthenticationConversation →
  • Overview
    • 1) Get the google-services.json file
    • 2) Obtain server key from firebase
    • 3) Add your server key to Kommunicate
    • 4) Gradle file configuration
  • Already have the push notification setup?
    • 1) Send the device token to Kommunicate
    • 2) Receive push notifications
  • Set notification small icon
Facebook Open Source

710 East Wing Street,
Arlington Heights, IL 60004,

(+1) (310) 909-7458
hello@kommunicate.io

Docs
WebAndroidiOSIonic/PhonegapReact NativeFlutter
Product
Pricing and FAQsRequest Demo
Social
FacebookTwitterLinkedin
Copyright © 2021 Kommunicate.io.