Offline Messaging
Learn how to receive push notifications when the app is not running.
Before you begin
- Register a QuickBlox account. This is a matter of a few minutes and you will be able to use this account to build your apps.
- Configure QuickBlox SDK for your app. Check out our Setup page for more details.
- Create a user session to be able to use QuickBlox functionality. See our Authentication page to learn how to do it.
- Connect to the Chat server. See our Connection page to learn how to do it.
Visit our Key Concepts page to get an overall understanding of the most important QuickBlox concepts.
Enable offline messaging
Send notifications about new messages to the user when their app is not running by using offline messaging functionality. This functionality allows to customize automatic push notifications displayed on a user's device when they are offline. In other words, if your opponent is offline when you are writing a message, they automatically receive a push notification.
Make sure to subscribe your users to pushes using SDKs. Review Push Notifications section for more details.
Only FCM data messages can be sent from the Android app. QuickBlox doesn't support FCM notification messages.
To process FCM data messages in your app when the app is in the background, you need to handle them. If not handled, they will not pop on the screen even if the app has received such push notifications. See FCM documentation to learn more about data messages.
Enable offline messaging from the Dashboard as follows:
- Navigate to the Dashboard => YOUR_APP => Chat => Offline messaging page to locate offline messaging settings.
- Check the Enable automatic push notifications for offline users if you want to receive push notifications from the server automatically.
Configure offline messaging template
You can configure an offline messaging template from the Dashboard as follows:
- Navigate to the Dashboard => YOUR_APP => Chat => Offline messaging page to locate offline messaging settings.
- Choose the template in the Templates section.
Available for Growth/HIPAA Cloud/Enterprise plan
You can set the custom template in the Offline messaging text section using the following template variables:
- %unread_count% - total number of new messages the recipient has
- %plural[new message]% - words in brackets (20 characters max) will be pluralized based on unread messages count
- %body[x]% - quote x characters from message body
- %recipient_fullname% - full name of recipient
- %sender_fullname% - full name of sender
- %recipient_login% - login of recipient
- %sender_login% - login of sender
- %dialog_name% - name of chat dialog (will be replaced with "Private dialog" string for 1-1 messages)
- Set Badge counter to include counter info into your push message. Useful to include an unread counter that is the number of unread messages a user has.
- Set push notification sound in the Sound section (for iOS only).
- Set the Category (iOS) field. Enter "actions" that should be presented in the app notification in various views (for iOS only).
- Enable the Content Available option to indicate that new content is available (for iOS only).
- Enable the Mutable content option to modify the content of newly delivered notifications before the user is alerted. Use a notification service app extension to be able to modify the content of the notification. If the option is enabled, the system passes the notification to the service app extension for the subsequent modification of the notification payload before the actual delivery (for iOS only).
- Click the Save button.
Currently, push notifications are supported in a mobile environment only.
Updated almost 3 years ago