There are two ways to set up push notifications with Rocket.Chat:
If you and your users intend to use the official Rocket.Chat mobile applications; you need to choose this option.
To allow push notifications to be received on our official mobile application by any server, we had to establish a push gateway containing our keys. In doing so, we protect our secret keys required to send through Apple(APN) and Google(FCM) to send you and your users notifications.
When you choose to self configure the push notifications, things become a bit more complicated. First, you need to get keys from both Apple and Google and compile/release your own mobile applications to the app stores so your public keys will be distributed to your users.
Then also, you will need to add your keys to Rocket.Chat.
Then you will have to compile them for iOS and Android and submit them to the appropriate app stores for review.
Finally, you would direct your users to download your custom version of the Rocket.Chat mobile applications.
Configuring for Android
The Rocket.Chat native application for Android supports the FCM system. Here's how you configure it:
Create a Firebase project in the Firebase console if you don't already have one. Click Add project. If you already have an existing Google project associated with your mobile app, select it from the Project name drop-down menu. Otherwise, enter a project name to create a new project.
Optional: Edit your Project ID. Your project is given a unique ID automatically, and it's used in publicly visible Firebase features such as database URLs and your Firebase Hosting subdomain. You can change it now if you want to use a specific subdomain.
Follow the remaining setup steps and click Create a project (or Add Firebase if you're using an existing project) to begin provisioning resources for your project. This typically takes a few minutes. When the process completes, you'll be taken to the project overview.
Now that you have a project, you can add your Android app to it:
Click Add Firebase to your Android app and follow the setup steps. If you're importing an existing Google project, this may happen automatically, and you can download the config file
When prompted, enter your app's package name. It's important to enter the package name your app uses; this can only be set when you add an app to your Firebase project
During the process, you'll download a google-services.json file. You can download this file again at any time
After you add the initialization code, run your app to send verification to the Firebase console that you've successfully installed Firebase
Set the Enable Gateway to False, then plug the information obtained from Apple and Google
Restart server (without this, it will not work)
Now you should be able to send a text message. Make sure that you have logged in to the server once and then closed the app. You should see a test notification after you pressed the send button.
Rocket.Chat allows for additional privacy configurations on push notifications:
Show Channel/Group/Username in Notification: Default is "TRUE", disabling this setting prevents the Channel, Group, Discussion, and Username from being sent to the push notification gateway
Show Message in Notification: Default is "TRUE", disabling this setting prevents the message content from being sent to the push notification gateway
If both settings are set to "FALSE", the user will receive a push notification without contextual information, as no such contextual information is sent to the push notification gateway in the first place. The user can then access the contextual information by opening the Rocket.Chat application. This is helpful in compliance-sensitive requirements like HIPAA to prevent sensitive information from being disclosed via push notification.
If you don't want notifications, you can disable the gateway and not provide keys
You cannot compile your own applications and use the Rocket.Chat push gateway
For iOS, you need to convert both the .cer and .p12 files into .pem files
Once everything is configured on the admin settings, the server must be restarted
I am getting, "Server notifications are misconfigured!"
If you are getting this message and are using our push gateway, please make sure:
Your server version is greater or equal to 0.74.3
Registered (you can check this by going to http://yourserver/admin/cloud)
Thanks to @lvh1 and @lunitic for starting this doc