# @cystain/novu-rest-js

> JS Rest client for Novu that utilizes fetch for wider compatibility

Latest version **0.0.13** (published 2023-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @cystain/novu-rest-js
pnpm add @cystain/novu-rest-js
yarn add @cystain/novu-rest-js
bun add @cystain/novu-rest-js
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.13 |
| Published | 2023-11-27 |
| First published | 2023-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 1 |
| Unpacked size | 13.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Christopher Mendoza |
| Maintainers | cystain |

## Links

- npm: https://www.npmjs.com/package/@cystain/novu-rest-js
- Repository: https://github.com/cystain/novu-rest-js
- Homepage: https://github.com/cystain/novu-rest-js#readme
- Issues: https://github.com/cystain/novu-rest-js/issues
- npm.io page: https://npm.io/package/@cystain/novu-rest-js

## Dependencies (1)

- [@novu/node](https://npm.io/package/@novu/node.md) ^0.19.0

## Recent versions

- 0.0.13 (latest) — 2023-11-27
- 0.0.12 — 2023-11-17
- 0.0.11 — 2023-10-01
- 0.0.10 — 2023-09-25
- 0.0.9 — 2023-09-25
- 0.0.8 — 2023-09-22
- 0.0.7 — 2023-09-22
- 0.0.6 — 2023-09-22
- 0.0.5 — 2023-09-19
- 0.0.4 — 2023-09-19
- 0.0.3 — 2023-09-18
- 0.0.2 — 2023-09-18
- 0.0.1 — 2023-09-18

## README

# Novu Rest Client for JS

A third-party library for invoking the REST APIs of Novu

(_still a work-in-progress_)

### Motivation

This is an open-source project that aims to provide wider compatibility to other non-node JS runtime.

#### Use case(s)

- Use on cloudflare workers - Since cloudflare workers do not natively run on Node runtime, `@novu/node` is not usable, mostly due to its use of `axios`. To solve this, we use `fetch()` for performing requests.

## Install as dependency

```shell
npm i @cystain/novu-rest-js
```

## Usage

```js
import { NovuRestClient } from '@cystain/novu-rest-js/lib/restClient';

const novuRestClient = new NovuRestClient('<YOUR_NOVU_API_KEY>');

// Sample trigger request (Trigger Event)
await novuRestClient.trigger('<WORKFLOW_TRIGGER_ID>', {
  to: {
    subscriberId: '<SUBSCRIBER_ID>',
  },
  payload: {
    title: 'Notif title',
    body: 'Notif body',
    link: 'http://example.com',
  },
  overrides: {
    fcm: {
      type: 'data',
    },
  },
});
```

For the request specifications, refer to the REST API doc: https://docs.novu.co/api-reference/events/trigger-event

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