basebot-middleware-fcm

0.5.1 • Public • Published

basebot-util-fcm

Send notifications using FCM

Usage

Requires the following env vars:

FIREBASE Your service account JSON (docs)

Example

  import { notify, schedule } from 'basebot-util-fcm'
  import { storage } from '../services'

  const notification = {
    userId: 'some-user-id',
    storage,
    payload: {
      text: 'Your report is ready',
      trigger: 'reportReady',
      click_action: 'NOTIFICATION_CLICK'
    }
  }

  // sending a notification immediately
  notify(notification)

  // scheduling a notification
  schedule(new Date(2020, 11, 21, 5, 30, 0), notification) // any date object

Readme

Keywords

none

Package Sidebar

Install

npm i basebot-middleware-fcm

Weekly Downloads

2

Version

0.5.1

License

MIT

Unpacked Size

3.86 kB

Total Files

6

Last publish

Collaborators

  • calvin-evans