Back to Novu

Novu Providers

packages/providers/README.md

3.15.01.6 KB
Original Source
<div align="center"> <a href="https://novu.co?utm_source=github" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/2233092/213641039-220ac15f-f367-4d13-9eaf-56e79433b8c1.png"> </picture> </a> </div>

Novu Providers

A collection of stateless notification delivery providers, abstracting the underlying delivery provider implementation details. Independently usable, and additionally consumed by the Novu Platform.

Installation

bash
npm install @novu/providers

Usage

The @novu/providers package contains a set of providers that can be used to send notifications to various channels.

The following example shows how to use the TwilioSmsProvider to send a message to a phone number.

javascript
import { TwilioSmsProvider } from '@novu/providers';

const provider = new TwilioSmsProvider({
  accountSid: process.env.TWILIO_ACCOUNT_SID,
  authToken: process.env.TWILIO_AUTH_TOKEN,
  from: process.env.TWILIO_FROM_NUMBER, // a valid twilio phone number
});

await provider.sendMessage({
  to: '0123456789',
  content: 'Message to send',
});

For all supported providers, visit the Novu Providers package.