0.0.13 • Published 6 months ago

@cystain/novu-rest-js v0.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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

npm i @cystain/novu-rest-js

Usage

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

0.0.13

6 months ago

0.0.12

6 months ago

0.0.11

7 months ago

0.0.10

8 months ago

0.0.9

8 months ago

0.0.8

8 months ago

0.0.7

8 months ago

0.0.6

8 months ago

0.0.5

8 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago