Build an API from Node.js for pushing notifications via Firebase Cloud Messaging (FCM) to the mobile application (Send to specific Device through token), testing on Postman.
Test.Postman.mp4
Created your own nodeJS server, received the registration token from the mobile application making the API call and sent a custom message using firebase cloud messaging.
First, you might want to have a glance at the mobile application that receives the notification through the API, check this repository for more information before going through this project 👇:
$ git clone https://github.com/tduongtad1304/FCM-API.git
- Firebase-admin 👉
npm i firebase-admin
- Express 👉
npm i express
- Body-parser 👉
npm i body-parser
You need to download and add the "service account" JSON file for interacting with mobile application, for more information:
Create a new collection and paste the url: localhost:3000/firebase/notification
, choose the method POST and choose the raw JSON type with the following structure:
{
"registrationToken": "your registration Token here (find on the mobile application)",
"title": "title of notification",
"body": "body of notification"
}