Push notifications
Push notifications tell visitors about new activity while your app is in the background or closed. Zoho SalesIQ sends them through Firebase Cloud Messaging (FCM), using the HTTP v1 API.
At Zylker Bakes, for example, visitors often ask about an order and then close the app. When an operator replies, the reply appears on the visitor's phone as a notification, and tapping it opens the chat.
Visitors receive notifications for the following events:
- New chat messages from operators or bots.
- Incoming voice calls, as well as missed and canceled calls.
- Chats that have ended.
- Messages that your team sends to previous visitors from the visitor history in SalesIQ. For example, an operator can start a new chat with a visitor, or send a campaign, such as a broadcast message. To learn how to send a broadcast, see Sending broadcast messages.
- Outbound messages that you send to many visitors at once, based on criteria you define in the SalesIQ console.
One setup covers all of these notifications. Your messaging service passes each SalesIQ notification to the SDK, and the SDK shows it and opens the right screen when the visitor taps it.
To handle each event type yourself instead, parse the payload into a SalesIQNotificationPayload object. Then check whether it is a Chat, Call, VisitorHistory, or EndChatDetails subtype.
How delivery works
The following diagram shows how a notification travels from SalesIQ to your app.
Setup overview
The setup has six steps. Step 1 and step 3 take place in the SalesIQ and Firebase consoles. The other steps are in your app project.
- Enable push notifications for your brand in the SalesIQ console.
- Add Firebase to your Android app.
- Upload your FCM HTTP v1 private key to SalesIQ.
- Add the notification permission.
- Register your messaging service.
- Pass incoming messages to the SDK and register the device token.
Step 1: Enable push notifications in the SalesIQ console
In the SalesIQ console, open Settings, select Brands, choose your brand, go to Installation, then Mobile SDK, and select Android. Then turn on Configure push notifications. You will upload your FCM private key on this same screen in step 3.
Step 2: Add Firebase to your app
If your app does not use Firebase yet, follow these steps:
- Create a Firebase project, or open an existing one.
- Add your Android app to the Firebase project.
- Download the
google-services.jsonfile and add it to your app module folder. - Add the Google Services Gradle plugin to your project.
For details, see the Firebase guide Add Firebase to your Android project.
Step 3: Upload the FCM HTTP v1 private key
SalesIQ needs a private key from your Firebase service account to send notifications on your behalf. The key is a JSON file, so store it securely. To generate the key and upload it to SalesIQ:
-
Open the Firebase console and select your project.
-
Click the gear icon, select Project settings, and go to the Service accounts tab.
-
Under Firebase Admin SDK, click Generate new private key.
-
Click Generate key to confirm. The key downloads to your computer as a JSON file.
-
Go back to Configure push notifications in the SalesIQ console, and click Browse.
-
Select the JSON file that you downloaded, and click Upload.
Make sure the Firebase Cloud Messaging API (V1) is enabled for your project. To check, open the Cloud Messaging tab in your Firebase project settings. If the API is disabled, click the three-dot menu next to Firebase Cloud Messaging API (V1), and select Manage API in Google Cloud Console. Then click Enable.

Step 4: Add the notification permission
On Android 13 (API level 33) and above, your app must declare the POST_NOTIFICATIONS permission and ask the visitor for it while the app runs. If the visitor does not allow it, replies still arrive in the chat, but the device does not show a notification.
Add the permission to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
To learn how to request the permission at runtime, see the Android guide on notification runtime permission.
Step 5: Register your messaging service
SalesIQ notifications arrive through a standard FirebaseMessagingService, which is the class that Firebase starts when a message reaches the device. If you are new to FCM, first follow the Firebase guide Set up an FCM client app on Android.
Declare your messaging service in your AndroidManifest.xml file:
<service
android:name=".MyFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
Step 6: Pass messages to the SDK
Your app may send its own notifications too. Zylker Bakes, for example, sends order updates. So the messaging service checks each message before it passes it on. Add the following code to your messaging service:
- In
onMessageReceived(), check whether the message is from SalesIQ, and pass SalesIQ messages to the SDK. - In
onNewToken(), register the new token with SalesIQ.
- Kotlin
- Java
class MyFirebaseMessagingService : FirebaseMessagingService() {
override fun onMessageReceived(remoteMessage: RemoteMessage) {
val data = remoteMessage.data
if (ZohoSalesIQ.Notification.isZohoSalesIQNotification(data)) {
ZohoSalesIQ.Notification.handle(applicationContext, data)
} else {
// Handle your app's own notifications.
}
}
override fun onNewToken(token: String) {
ZohoSalesIQ.Notification.enablePush(token, isTestDevice = false)
}
}
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Map<String, String> data = remoteMessage.getData();
if (ZohoSalesIQ.Notification.isZohoSalesIQNotification(data)) {
ZohoSalesIQ.Notification.handle(getApplicationContext(), data);
} else {
// Handle your app's own notifications.
}
}
@Override
public void onNewToken(String token) {
ZohoSalesIQ.Notification.enablePush(token, false);
}
}
Register the device
SalesIQ can send notifications to a device only after you register the device's FCM token. Call enablePush() after the SDK is initialized, and again from onNewToken() whenever Firebase issues a new token.
- Kotlin
- Java
ZohoSalesIQ.Notification.enablePush(fcmToken, isTestDevice = false)
ZohoSalesIQ.Notification.enablePush(fcmToken, false);
| Parameter | Type | Description |
|---|---|---|
token | String | The FCM registration token for the device. |
isTestDevice | Boolean | Set to true to receive test messages from the SalesIQ console, or false for production. |
Unregister the device
To stop notifications on a device, for example when the visitor logs out, call disablePush(). It uses the FCM token that you registered with enablePush(), so it takes no parameters.
- Kotlin
- Java
ZohoSalesIQ.Notification.disablePush()
ZohoSalesIQ.Notification.disablePush();
Identify SalesIQ notifications
When your app receives its own notifications as well, check whether a payload is from SalesIQ before you handle it:
- Kotlin
- Java
val isSalesIQ = ZohoSalesIQ.Notification.isZohoSalesIQNotification(data)
boolean isSalesIQ = ZohoSalesIQ.Notification.isZohoSalesIQNotification(data);
Handle the notification tap
By default, the SDK opens the chat when the visitor taps a SalesIQ notification. To handle the tap in your app instead, change the action source:
- Kotlin
- Java
// The SDK opens the relevant chat. This is the default.
ZohoSalesIQ.Notification.setActionSource(ZohoSalesIQ.ActionSource.SDK)
// Your app receives the payload and handles the navigation.
ZohoSalesIQ.Notification.setActionSource(ZohoSalesIQ.ActionSource.APP)
// The SDK opens the relevant chat. This is the default.
ZohoSalesIQ.Notification.setActionSource(ZohoSalesIQ.ActionSource.SDK);
// Your app receives the payload and handles the navigation.
ZohoSalesIQ.Notification.setActionSource(ZohoSalesIQ.ActionSource.APP);
| Source | Description |
|---|---|
SDK | The SDK opens the relevant chat when the visitor taps the notification. This is the default. |
APP | Your app receives the payload through NotificationListener.onClick() and handles the navigation. |
Customize the notification
Small icon
The small icon of the notification is a style attribute, so it follows your app's theme. To use your own icon, override siq_notification_small_icon in your SalesIQ theme. Its background color is set by siq_notification_small_icon_background_color.
<item name="siq_notification_small_icon">@drawable/ic_notification</item>
<item name="siq_notification_small_icon_background_color">@color/your_accent</item>
To learn how to override the SalesIQ theme, see the Customize the colors section. The Styles section lists every attribute that you can change.
Channel name
By default, the SDK posts notifications to a channel named "Support Notifications". Visitors see this name in the notification settings of your app. To change it, override the following string resource:
<string name="siq_mobilisten_notification_channel_name">Messages from support</string>
Test your setup
To check your setup, send a test notification from the SalesIQ console:
- Register the device with
isTestDeviceset totrue. - In the SalesIQ console, open the push notification test option on the Android installation screen.
- Enter your message and click Send. All registered test devices receive the message.
When you delete a test device, it stops receiving test messages only. Production notifications still arrive.