0.5.1 • Published 5 years ago

basebot-middleware-fcm v0.5.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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
0.5.1

5 years ago

0.0.1

5 years ago

0.1.1

5 years ago