JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q30368F
  • License MIT

FCM (send-message) implementation based on REST API, supports proxy

Package Exports

  • fcm-rest
  • fcm-rest/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fcm-rest) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

FCM-REST

FCM implementation based on REST API, supports proxy. No dependencies on firebase framework.

Implements send-message HTTP APIs v1 and legacy

https://firebase.google.com/docs/cloud-messaging/send-message#send_using_the_fcm_legacy_http_api

Installation

npm install fcm-rest

Usage

// esm
import fcm from 'fcm-rest/index.mjs'

// cjs
//const fcm = require('fcm-rest')

// message recipient
const clientToken = 'ZkVNZ...'

// Use legacy FCM API
const serverKey = 'AAAA...'
await fcm.sendMessageLegacy(serverKey, clientToken, {
  notification: { title: 'Hi there' }
})

// Use v1 FCM API
const gcpServiceAccount = {
  client_email: '***',
  project_id  : '***',
  private_key : '***',
  ...
}
await fcm.sendMessageV1(gcpServiceAccount, clientToken, {
  notification: { title: 'Hi there' }
})