We’ll show you how to send push notifications and/or push messages to your customers, with Firebase Cloud Messaging (FCM) in Salesmate Chat.
Step 1. Enable Google services for your app
If you already have a Firebase project with notifications enabled you can skip to the next step. Otherwise, go to the FCM Console page and create a new project following these steps:
Give the project a name and click ‘Create Project’.

Once your project is set up, scroll down and select the ‘Cloud Messaging’’ card.

Click on the Android icon to continue the setup.
Enter your app’s package name and click ‘Register App’.

Step 2. Setup client to receive push
Click the button "Download google-services.json" to download the config file. You’ll need to move that file into the same directory as your application level
.build.gradle

Click "next" and then in your apps
you will need to add the following lines to your dependencies:build.gradle
dependencies {
implementation 'Comming Soon'
implementation 'com.google.firebase:firebase-messaging:20.2.+'
}
At the bottom of your
you must add:build.gradle
apply plugin: 'com.google.gms.google-services'
It is important that this is at the very end of the file.
Click the Next button and then skip the verification step.
Step 3. Add your Server key to Salesmate Sales-CRM for Android settings
Finally, click the settings cog and select ‘Project settings’, then ‘Cloud Messaging tab’ and copy your Server key.

Open your Salesmate Messenger settings and select ‘Installation → Android’. Then find the ‘Enable Push Notifications’ section. Here you'll be able to paste and save your Server API key.
Step 4. Disable push on log out
To stop users from receiving push messages when they have logged out of the app make sure to call:
SalesmateChatSDK.getInstance().logout()
Step 5. Using Salesmate Chat with FCM - Setup
If your application uses FCM for your own content, or if you use a third-party service for FCM. You’ll need to update your
.FirebaseMessagingService
You should have a class that extends
That service is where you get the device token to send to your backend to register for the push. To register for Salesmate Chat push set it up like this:FirebaseMessagingService.
override fun onNewToken(token: String) {
super.onNewToken(token)
SalesmatePushClient.getInstance().sendTokenToSalesmate(token)
}
override fun onMessageReceived(remoteMessage: RemoteMessage) {
super.onMessageReceived(remoteMessage)
val valueMap: MutableMap<String, String> = remoteMessage.data
if (SalesmatePushClient.getInstance().isSalesmateChatSDKPush(valueMap)) {
SalesmatePushClient.getInstance().handleSalesmateChatSDKPush(valueMap)
return
}
}
📘 Important
The recommendation of sendTokenToSalesmate() is to call it on the initial launch of an app to update the fresh firebase token into Salesmate
Troubleshooting tips
If you’re having trouble getting FCM to work in your app, here's a list of things you should check:
- Check that the notifications are not disabled for your app on your test device. Settings > Sound & Notification > App notifications. This may differ depending on the Android version.
- Did you specify the correct Push Server API key?
- Make sure you added your
file in the correct directory.google-services.json
Comments
0 comments
Please sign in to leave a comment.