1. Home
  2. Docs
  3. Xenforo Addon
  4. Push notifications

Push notifications

The addon sends push notifications to the app by using the Firebase Cloud Messaging api.

To allow your server to call the Firebase Server APIS and send push notifications to your users, you have to generate a private key in the Firebase console.

In your firebase console, open the Project you created for the native apps, and open Settings-Service Accounts.

Push notifications 1
Push notifications 2

A json file with a private key will be generated and downloaded to your computer. Please store it securely.

Upload the private key to your server.

The server where your forum is hosted needs this json file containing the private key, to be able to send push notifications to your users. You have to upload the file to the server and store it in a place that is not accessible from the internet.

That means, you should not be able to call this file with an url, like https://yourforum.com/privatekey.json.

There are two ways to achieve that:

If you have a VPS Server.

If you are hosting your forum on your own virtual or dedicated server, place the file on a folder that is above the classical /var/www/html folder. Please make sure that the webserver Linux user (for example www-data in the case of Apache), has read permissions over the file.

If you have a shared hosting.

Despite having a shared hosting, maybe you can place the file above the public HTML folder. If this is the case, please take this way.

If not, then you have to place the file inside a folder under your public HTML folder, and protect with a .htaccess file to disallow all the requests to this route, for example adding the following to your .htaccess:

<Files "your_private_key.json">  
  Require all denied
</Files>

If you are taking this way, please double check that your private key file is not internet accessible.

Configure the path to your private key on the addon options.

After uploading the key to your server, configure the path to the file in the addon options section. This has to be the absolute path of the file, for example: /var/www/mysite/private-key.json

Push notifications 3

If you have questions about this or other topics, feel free to contact us and ask!

Was this article helpful to you? Yes 1 No