Notifications
ASAPP provides the following notifications:
Push Notifications
ASAPP’s systems may trigger push notifications at certain times, such as when an agent sends a message to an end customer who does not currently have the chat interface open. In such scenarios, ASAPP calls your company’s API with data that identifies the recipient’s device, which triggers push notifications. ASAPP’s servers do not communicate with Firebase directly.
ASAPP provides methods in the SDK to register and deregister the customer’s device for push notifications.
For a deeper dive on how ASAPP and your company’s API handle push notifications, please see our documentation on Push Notifications and the Mobile SDKs.
In addition to this section, see Android’s documentation about Firebase Cloud Messaging and specifically how to setup Android Cloud Messaging.
Enable Push Notifications
-
Identify which token you will use to send push notifications to the current user. This token is usually either the Firebase instance ID or an identifier generated by your company’s API for this purpose.
-
Then, register the push notification token using:
In case you issue a new token to the current user, you also need to update it in the SDK.
Disable Push Notifications
In case the user logs out of the application or other related scenarios, you can disable push notifications for the current user by calling:
ASAPP.instance.disablePushNotifications().
Call this function before you change ASAPP.instance.user
(or clear the session) to prevent the customer from receiving unintended push notifications.
Handle Push Notifications
You can verify if ASAPP triggered a push notification and passed a data payload into the SDK.
Your application usually won’t receive push notifications from ASAPP if the identified user for this device is connected to chat.
For a deeper dive on how Android handles push notifications, please see the Firebase docs on Receiving Messages in Android.
Background Push Notifications
If your app receives a push notification while in the background or closed, the system will display the OS notification. Once the user taps the notification, the app starts with Intent
data from that push notification.
To help differentiate notifications from ASAPP and others your app might receive, ASAPP recommends that the push notification has a click_action
with the value asapp.intent.action.OPEN_CHAT
. For more information on how to set a click action, please see the Firebase documentation. With a click action set to the push notification, you will need to add a new intent filter to match it:
Once you create the activity, check if it’s an ASAPP notification, and then open chat with the data:
The helper function shouldOpenChat
simply checks if the intent action matches the recommended one, but its use is optional.
Foreground Push Notifications
When you receive Firebase push notifications while your app is in the foreground, it will call FirebaseMessagingService.onMessageReceived
. Check if that notification is from ASAPP:
For a good user experience, ASAPP recommends providing UI feedback to indicate there are new messages instead of opening chat right away. For example, update the unread message counter for your app’s chat badge. You can retrieve that information from: ASAPP.instance.conversationStatusHandler
.
Persistent Notifications
The ASAPP Android SDK will automatically surface a persistent notification when a user joins a queue or is connected to a live agent (starting on v8.4.0). Tapping the notification triggers an intent that takes the user directly into ASAPP Chat. Once the live chat ends or the user leaves the queue, the notification is dismissed.
Persistent notifications are:
- ongoing, not dismissible notifications.
- low priority and do not vibrate or make sounds.
- managed directly by the SDK and do not require integration changes.
ASAPP enables this feature by default. To disable it, please reach out to your ASAPP Implementation Manager.
Persistent notifications are not push notifications, which are created and handled by your application.
Customize Persistent Notifications
Notification Title and Icon
To customize the title of persistent notifications, override the following string resource:
And to customize the icon, create a new drawable resource with the following identifier (file name):
ASAPP recommends that you do not change the body of persistent notifications.
Notification Channel
By default, ASAPP sets the notification to Notification Channel asapp_chat
, but it is possible to customize the channel being used.
To customize the channel used by persistent notifications, override the following string resources:
Was this page helpful?