Posted May 10 by Edmund Clayton.
Updated Oct 30.

Learn how to use Firebase Cloud Messaging with push notifications.

Last activity Oct 30 by Edmund Clayton.
476 views. 0 comments.

Chapter 5 – Enabling Push Notifications for Firebase Cloud Messaging

5.1 - Firebase and Push Notifications

The AppWorks Gateway uses the public Firebase Cloud Message (FCM) service to enable native push notifications. Push notifications are configured for each mobile runtime using the Google developer console. A Firebase Project model is used for working with Firebase projects in the AppWorks Gateway.

To set up push notifications:

  1. Sign in to the AppWorks Gateway as an admin user.

  2. In the Admin Menu, click FCM Configuration.

  3. Click Add Entry and complete the following fields:

    Project Private Key File – A service account JSON file also used to call Firebase APIs.

    Project ID – A globally unique identifier for the project

    Server Key – A key to authorize AppWorks Gateways calls against the Firebase APIs

    Sender ID – The ID used by the AppWorks Gateway for itself as a sender of push notifications, push clients ask to be sent notifications from a sender

    Web Push Certificate Public Key – A public key used by, the now supported, in browser push clients.

    Web Push SDK Configuration – A JSON configuration String to allow in-browser web clients to easily make use of the Firebase JavaScript client library at

The following section assumes you have a valid Google developer account and can access the console at Select the cog wheel in the left-hand menu at the Project Overview level, and select Project settings to view the Firebase Project Settings.

This tabbed view provides access to the general project's details and the cloud messaging configuration, which includes any number of apps and their access files (google-services.json, GoogleService-Info.plist), and service accounts.

Project ID
The general project identifier found on the General tab under Settings.

Server Key
A server key that authorizes our app server, the AppWorks Gateway, to access Google services. It is available on the Cloud Messaging under Settings.

Project Private Key File
This is a service account file generated for the project. It is used by the AppWorks Gateway when communicating with the Google APIs involved in sending push notifications to mobile and web clients.

In the Service Account tab of the Settings we can generate a new file using the Generate new private key. This file should be uploaded in the Firebase Project creation form in the AppWorks Gateway.

Web Push Notifications
Firebase Cloud Messaging supports web clients as well as Android and iOS clients. The following two fields on the Firebase Project support web-based clients that contact the AppWorks Gateway for such messages.

Web Push Certificate Public Key – The public key of any Web Push certificate generated in the Web Configuration found at the bottom of the Cloud Messaging tab under Settings for the project.

Web Push SDK Configuration
The public configuration code block for a JavaScript app that will use the FCM client exposed by the AppWorks Gateway. The value can be copied directly from the Firebase console as described below. JavaScript applications may use the Firebase JavaScript SDK to receive push notifications in the browser.

From the Firebase projects overview page, do the following:

  1. Click + Add App below the project name.

  2. Select the web application, depicted by angled brackets.

  3. Copy the content of the config variable is JSON block out of the provided <script> tags, for example:


    apiKey: "AIzaSyBgXYFblWR5_IE2zfYeARydmjVdTLXljGI",

    authDomain: "",

    databaseURL: "",

    projectId: "a-customer-project",

    storageBucket: "",

    messagingSenderId: "944462086369"


  4. Paste the JSON block into the Web Push Notifications field in the AppWorks Gateway:

enter image description here

5.2 - Sending a Test Notification

You can send a test notification to connected mobile devices. A mobile client must have connected to the AppWorks Gateway successfully at least once to receive a notification. When you complete the details of the notification, you specify the target app and the users that you want to notify.

To send a test notification:

  1. Sign in to the AppWorks Gateway as an admin user.

  2. In the Admin menu, click Notification Test from the Push Notification section.

  3. In the Native Alert region, enter a Title and Notification Summary.

  4. In the AppWorks Data region, enter the Data Summary and Data Payload. The data provided here will be shown in the alert seen on the receiving devices operating system, as opposed to within the AppWorks mobile client.

    Depending on the device version and platform this may mean the data will be visible in a notification centre, on a banner or in an interactive alert.

  5. In the AppWorks Data region, enter the Data Summary and Data Payload. The data provided is used by the AppWorks mobile client, and will feature on the notifications seen therein. Notification data can be passed directly into a target AppWorks app running within the AppWorks client via a JSON payload. This payload is used in conjunction with the AppWorksJS framework provided for mobile developers to create reactive hybrid applications.

  6. In the Target AppWorks App box, click Search App and search for the app to which you want to send the notification.

  7. In the Username/First Name/Last Name field, search for the user to whom you want to send this notification.

  8. Select the required user from the search result.

  9. Click Send.

Top of page

Table of Contents

Your comment

To leave a comment, please sign in.