# @hatsa/notifications

> Send notifications using different transport, like: 'push', 'email'

Latest version **1.0.95** (published 2023-04-25) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install @hatsa/notifications
pnpm add @hatsa/notifications
yarn add @hatsa/notifications
bun add @hatsa/notifications
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.95 |
| Published | 2023-04-25 |
| First published | 2020-08-06 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 137.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | florisvink |

## Links

- npm: https://www.npmjs.com/package/@hatsa/notifications
- npm.io page: https://npm.io/package/@hatsa/notifications

## Dependencies (8)

- [lodash](https://npm.io/package/lodash.md) ^4.17.19
- [@hatsa/log](https://npm.io/package/@hatsa/log.md) ^0.8.38
- [@hatsa/utils](https://npm.io/package/@hatsa/utils.md) ^0.8.29
- [@hatsa/config](https://npm.io/package/@hatsa/config.md) ^0.8.37
- [firebase-admin](https://npm.io/package/firebase-admin.md) ^9.11.0
- [@hatsa/firebase](https://npm.io/package/@hatsa/firebase.md) ^0.8.52
- [@hatsa/firestore](https://npm.io/package/@hatsa/firestore.md) ^0.8.105
- [@google-cloud/tasks](https://npm.io/package/@google-cloud/tasks.md) ^2.1.0

## Recent versions

- 1.0.95 (latest) — 2023-04-25
- 1.0.94 — 2023-03-28
- 1.0.93 — 2023-02-01
- 1.0.92 — 2023-01-06
- 1.0.91 — 2022-12-27
- 1.0.90 — 2022-12-19
- 1.0.89 — 2022-12-12
- 1.0.88 — 2022-11-29
- 1.0.87 — 2022-11-22
- 1.0.86 — 2022-11-15
- 1.0.85 — 2022-11-09
- 1.0.84 — 2022-11-03
- 1.0.83 — 2022-10-31
- 1.0.82 — 2022-10-25
- 1.0.81 — 2022-10-25
- … 80 more at https://npm.io/package/@hatsa/notifications/versions

## README

# Package - @hatsa/notifications

## Usage

```javascript
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

```javascript
{
  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

```shell script
google_cloud_project                  #-> projectId
notifications_handler_queue           #-> queueId
notifications_handler_function_url    #-> functionUrl
notifications_handler_service_account #-> serviceAccount
```

---
_Source: https://npm.io/package/@hatsa/notifications · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
