QuickBlox Documentation

QuickBlox provides powerful Chat API and SDK to add real-time messaging and video calls to your web and mobile apps. Learn how to integrate QuickBlox across multiple platforms.

Push Notifications

Learn how to send push notifications to users when they are offline.

Push Notifications provide a way to deliver some information to a user while they are not using your app actively. The following use cases can be covered by push notifications:

  • Offline messages. Send a chat message when a recipient is offline. In this case, a push notification will be sent automatically if the user is offline.
  • Offline calls. Make a video/audio call with offline opponents. In this case, a push notification will be sent manually.
  • Requests to contact list. Send requests to add a user to the contact list. In this case, a push notification will be sent manually).
  • User tags. Send notifications to specific user groups defined by tags.

Visit our Key Concepts page to get an overall understanding of the most important QuickBlox concepts.

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.

Configuration

In order to start working with push notifications, you need to configure it.

  • For iOS application that uses Apple Push Notifications, you must have APNS certificate uploaded via the QuickBlox Dashboard Console panel. Review this page for more details.
  • For Android application that uses Firebase Cloud Messaging (FCM) you need to obtain API Key and set it on QuickBlox Dashboard Console panel. Review this page for more details.

Send push notifications

You can manually initiate sending push notifications to user/users on any event in your application. To do so, you need to form push notification parameters (payload) and set the push recipients.

var payload = JSON.stringify({
  message: "New market products are available",
  ios_voip: "1",
  VOIPCall: "1"
});
var pushParameters = {
  notification_type: "push",
  user: { ids: [21, 12] }, // recipients.
  environment: "development", // environment, can be 'production'.
  message: QB.pushnotifications.base64Encode(payload)
};

QB.pushnotifications.events.create(pushParameters, function(error, result) {
  if (error) {
    console.log(error);
  } else {
    // success
    console.log("Push Notification is sent.");
  }
});

📘

You can send APNS VoIP notifications from the web app to the iOS app. However, if the iOS app is not subscribed to APNS VoIP notifications or the APNS VoIP certificate has expired, the regular APNS will be delivered instead of APNS VoIP.

Updated 15 days ago


What's Next

Custom Objects

Push Notifications


Learn how to send push notifications to users when they are offline.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.