@hatsa/notifications
TypeScript icon, indicating that this package has built-in type declarations

1.0.95 • Public • Published

Package - @hatsa/notifications

Usage

const sendPushNotification = genSendNotification({ firebase, logger, config, options });

sendPushNotification({ profileId, type, notification }).then().catch();

Where

genSendNotification

  • firebase - firebase-admin module
  • logger - Logger instance from @hatsa/log package
  • config - Config instance from @hatsa/config package
  • options - Optional argument see "Required options" section below.

sendPushNotification

  • profileId - User profile ID.
  • type - Notification type. Check notification-types.js for available types.
  • notification - Notification object. (Mostly the data of notification object from firestore)

Required options

Under the hood @hatsa/notifications package uses a CloudTask queue. That's why we need to pass some options in. We can pass it in as an options argument, or set in environment variables.

Options argument

{
  projectId: string; // Project ID
  queueId: string; // Queue ID
  functionUrl: string; // Handler function URL
  serviceAccount: string; // Service account email
  location: string; // Optional parameter, default value is "us-central1".
}

Environment variables

google_cloud_project                  #-> projectId
notifications_handler_queue           #-> queueId
notifications_handler_function_url    #-> functionUrl
notifications_handler_service_account #-> serviceAccount

Readme

Keywords

none

Package Sidebar

Install

npm i @hatsa/notifications

Weekly Downloads

1

Version

1.0.95

License

UNLICENSED

Unpacked Size

141 kB

Total Files

74

Last publish

Collaborators

  • florisvink