/FCM-API

Build an API from Node.js for pushing notifications via Firebase Cloud Messaging (FCM) to the mobile application, testing on Postman.

Primary LanguageJavaScript

FCM-API

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

Check it out! 👇

Main topic 📓

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 👇:

Usage 👨‍💻

Going through it, first, clone this repository by:

$ git clone https://github.com/tduongtad1304/FCM-API.git

Then, installing require dependencies, including:

or just simply: npm install

⚠ Important:

You need to download and add the "service account" JSON file for interacting with mobile application, for more information:

Next, just run the code by: npm start

Testing on Postman ✔

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"
}

image

Then click Send and enjoy.