Firebase WordPress Notifications
Last updated: Feb 06, 2022
Follow Twitter for updates.
Fire Notifications (v1.0.0) is a WordPress plugin that help send notifications / messages from WordPress platform.
Download plugin: https://techcater.com
Video Tutorials: Youtube Playlist - Firebase WordPress Push Notifications
Note
This project is under active development.
First steps
Introductions
After downloading the Fire Notifications plugin, please follow the instructions in order to have better review of how to install and make use of this plugin in your WordPress site.
One thing you should note is all of the data only belongs your firebase project, so you will have control of all of data.
List of features
Send Messages to a WordPress clients when a post / page is updated
Programmatically send messages basing on triggers
More to come…
Plugin Configuration
After you download the zip file of Fire Notifications, you can upload directly to the WordPress dashboard.
Prepare CLoud Messaging Credentials
You can get it by logging into https://console.firebase.google.com: Project Settings > Cloud Messaging

Cloud Messaging
Then you enter the information in WordPress Dashboard: Fire Notifications > General

General information
Prepare Firebase Credentials
Before using the plugin, we need have the credentials from Firebase Console. You can get it by logging into https://console.firebase.google.com.

Firebase Credentials
Then you enter the information in WordPress Dashboard: Fire Notifications > Firebase

Firebase Credentials
Update Firestore Security Rules
The notifications mechanism relies on Firestore, in order to keep track of your web clients subscription. Please add this rule to your Firestore.
match /wpTokens/{token} {
allow write: if true;
}
After you finish all the configuration, the next step is to install cloud functions, so you web clients can receive notifications.
Firebase Cloud Functions Deployment
This is step is important, without this. Your web clients will not able to receive notifications.
Prerequisite
In order to deploy cloud functions, you need to have Nodejs v14 installed on your machine.
On Google Cloud Platform, go to your project and make sure Cloud Buid API and Cloud Functions are enabled. And the account that you use to deploy has Service Account User Role in order to deploy cloud functions to Firebase.
Then install firebase-tools packaged
npm install -g firebase-tools
SignIn and test firebase cli
firebase login
Change Your Plan to Blaze
Why will I need a billing account to use the Node.js 10 runtime for Cloud Functions for Firebase?
Because of updates to its underlying architecture planned for August 17, 2020, Cloud Functions for Firebase will rely on some additional paid Google services: Cloud Build, Container Registry, and Cloud Storage. These architecture updates will apply for functions deployed to the Node.js 10 runtime. Usage of these services will be billed in addition to existing pricing.

Firebase pricing plans
Install Packages & Deploy Cloud Functions
Install packages and build functions. I’m using Yarn, you can use npm if you want.
cd functions/
yarn OR npm install
The code will go to functions folder, then installs packages with yarn / npm.
Start deploying firebase functions
cd functions
yarn deploy --project project-id
// OR
firebase deploy --only functions --project project-id
The deployment result should look like this
✔ functions: Finished running predeploy script.
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (103.29 KB) for uploading
✔ functions: functions folder uploaded successfully
i functions: updating Node.js 14 function wpTokens-onCreate(us-central1)...
✔ functions[wpTokens-onCreate(us-central1)] Successful update operation.
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/project-id/overview
✨ Done in 77.56s.
Just to verify that everything works, you can find a cloud functions wpTokens-onCreate in your firebase console after the deployment.
Miscellaneous
CHANGELOG
All notable changes to this project will be documented in this file.
## [ 1.1.0 ] - 2022-02-06
#### - :rocket: [New Feature]
improve service worker loading
lazyloading scripts to improve performance
## [ 1.0.0 ] - 2022-01-15
#### - :rocket: [New Feature]
Initialized fire notifications plugin