-
Clone this repository
git clone https://github.com/JunubiLabs/firebase-notification.git
-
Download Firebase service account JSON from Firebase Console → Project Settings → Service accounts, save it as e.g.
fcmServiceAccountKey.json, and **add to project folder.
npm installnpx ts-node src/index.tsPOST /sendNotification
Content-Type: application/json
{
"fcmToken": "<DEVICE_TOKEN>",
"topic": "topic",
"title": "Hello!",
"body": "This is a push notification.",
"data": { "foo": "bar" }
}- Ensure your client (web/mobile) collects and sends FCM registration tokens to this server.
- On web, you'll need
firebase-messaging-sw.jsand locate your VAPID key as shown in the [Firebase web docs]([github.com][1], [medium.com][2], [medium.com][3], [mindbowser.com][4], [firebase.google.com][5]). - For mobile, use the platform SDK to retrieve the token and submit it.