Offline Messaging

Learn how to receive push notifications when the app is not running.

Before you begin

  1. 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.
  2. Configure QuickBlox SDK for your app. Check out our Setup page for more details.
  3. Create a user session to be able to use QuickBlox functionality. See our Authentication page to learn how to do it.
  4. 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:

  1. Navigate to the Dashboard => YOUR_APP => Chat => Offline messaging page to locate offline messaging settings.
  2. Check the Enable automatic push notifications for offline users if you want to receive push notifications from the server automatically.
2310

Configure offline messaging template

You can configure an offline messaging template from the Dashboard as follows:

  1. Navigate to the Dashboard => YOUR_APP => Chat => Offline messaging page to locate offline messaging settings.
  2. 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)
  1. 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.
  2. Set push notification sound in the Sound section (for iOS only).
  3. Set the Category (iOS) field. Enter "actions" that should be presented in the app notification in various views (for iOS only).
  4. Enable the Content Available option to indicate that new content is available (for iOS only).
  5. 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).
  6. Click the Save button.
1848

🚧

Currently, push notifications are supported in a mobile environment only.


What’s Next