Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Brings the Firebase Admin's FCM send messaging capability through a REST API

License

Notifications You must be signed in to change notification settings

adoankim/simple-fcm-notifications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple-FCM-API

This project exposes the Firebase Cloud Messaging (FCM) notification send through a REST API using the Firebase Admin SDK

Requirements

Setup

git clone https://github.com/adoankim/simple-fcm-notifications.git
cd single-fcm-notifications
./setup.sh

Running the server

CERTIFICATE_PATH=./path/to/your/service/account/certificate
start.sh [PORT_NUMBER]

The default port is: 8080

Sample request

curl -d '{"notification": { "title": "Simple-FCM", "body": "Hello world!" }}' \
     -H "Content-Type: application/json" \
     http://localhost:8080/notification/<DEVICE_FCM_TOKEN> -v

Endpoints

Note: All endpoints require the application/json header in the request.


POST /notification/<FCM_TOKEN>

  • Payload types:

    • Only notification:

      { 
        "notification" : {
          "title": "this is a title",
          "body" : "this is a body"
        } 
      }
      
    • Only data:

      { 
        "data" : {
          "x": 20.0,
          "y": 35.5,
          "z": 40.5,
        } 
      }
      
    • Both:

      { 
        "notification" : {
          "title": "this is a title",
          "body" : "this is a body"
        },
        "data" : {
          "x": 20.0,
          "y": 35.5,
          "z": 40.5,
        }
      }
      

TODOs

  • Serve an HTML form to send request from the browser
  • Extend the API with other FCM functionalities

About

Brings the Firebase Admin's FCM send messaging capability through a REST API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published