Chatilo
USDPrices shown in US dollars Sign in Start free trial
For platform admins

Set up push notifications

What the server needs for browser notifications, and how to add the Apple and Google keys that let the native apps receive notifications.

Last updated

On this page
  1. Browser notifications: nothing to enter
  2. Native apps: add the Apple and Google keys
  3. Check the browser push code
  4. Redraw the app icons
  5. Common problems

Chatilo tells a customer's team about new messages in two ways. Browser notifications, including the app installed from the browser, work without any setup. Notifications to the native apps on iPhone, iPad, Mac and Android need keys from Apple and Google, which you enter on the App notifications page.

Browser notifications: nothing to enter

The server creates its own notification keys (VAPID keys) the first time they are needed and stores them in the database. You never see or type them.

What the server needs:

  • HTTPS. Browsers only allow notifications on a secure site.
  • The PHP openssl extension, with support for P-256 keys and AES-128-GCM.
  • The background worker. Notifications are sent by queued jobs. See Set up the background worker.
  • Outgoing HTTPS, to reach the push service of each user's browser.

Support email shown to customers (in Platform settings) is given to push services as the contact address for this server. If it is empty, the site's address is used.

The private half of the notification keys is encrypted with the app key in config/config.php. Keep that file with your database backups. See Back up and restore.

Native apps: add the Apple and Google keys

Without keys the apps still work and show new messages while they are open. They cannot be woken by a notification. The Windows app shows notifications while it is running and needs no key.

In the admin sidebar, click App notifications. The Right now card shows how many app sign-ins exist and how many Apple and Android devices have notifications turned on.

Apple (iPhone, iPad, Mac)

  1. In your Apple Developer account, create a key with the Apple Push Notifications service (APNs) enabled, and download its .p8 file. One key works for every app.
  2. On App notifications, fill in:

    • Team ID: 10 letters and digits, from your Apple Developer membership details.
    • Key ID: 10 letters and digits, shown next to the key you created.
    • Bundle ID of the app: the identifier the iPhone and Mac app was built with. It is used when an app does not report its own.
    • Key file (.p8): open the downloaded file in a text editor and paste all of it, including the BEGIN and END lines.
  3. Click Save. The badge beside Apple (iPhone, iPad, Mac) changes from Needs keys to Sending.

Google (Android)

  1. In the Firebase project the Android app was built with, generate a new private key for a service account and download the JSON file.
  2. On App notifications, paste the whole file into Service account file (JSON).
  3. Click Save. The badge beside Google (Android) changes to Sending, and the page shows the Firebase project's name.

Both keys are stored encrypted and never shown again. A saved field shows Saved. Leave empty to keep it. To take a key out, tick Remove the saved Apple key or Remove the saved Firebase key and click Save.

Check the browser push code

Over SSH, from the application folder, run:

php bin/push-selftest.php

It checks the encryption and signing code without contacting any push service, and on an installed site it also checks the stored keys. Each line starts with PASS or FAIL. The last line reads All checks passed. when everything is fine.

To test for real, sign in on a phone, turn notifications on, then send a message to a connected number from another phone. See Install the phone app.

Redraw the app icons

The icons of the app installed from the browser are files in public/assets/icons/. To redraw them from the logo shape, run this from the application folder. It needs the PHP gd extension.

php bin/make-icons.php

It writes six PNG files and prints each name and size.

Common problems

"The Team ID is 10 letters and digits." / "The Key ID is 10 letters and digits."

Copy the value again from your Apple Developer account. Both are exactly 10 characters.

"That isn’t a valid Apple key. Paste the whole .p8 file, including the BEGIN and END lines."

Part of the file is missing. Paste the complete text of the .p8 file.

"That isn’t a Firebase service account file…"

Paste the whole JSON file generated under Firebase → Project settings → Service accounts.

"The GD extension is not installed."

bin/make-icons.php needs gd. Enable it for the command-line PHP, or keep the supplied icons.

Nobody is offered browser notifications

The site is not on HTTPS, or the server's OpenSSL cannot create the keys. Look in Today’s log on the System page for Push keys unavailable.

Notifications stopped after restoring a backup or reinstalling

The app key changed, so the stored keys can no longer be read. Restore the original config/config.php.

Notifications arrive late or not at all

Check that the background worker is running and look for failed SendPush jobs on the System page.

Cookies on this site

We use the cookies needed to run the site and keep you signed in. With your OK we also remember choices you make here, such as the currency for prices. We don’t use advertising or tracking cookies. Cookie policy