📦 Install
npm install @novu/stateless
yarn add @novu/stateless
🔨 Usage
import { NovuStateless, ChannelTypeEnum } from '@novu/stateless';
import { SendgridEmailProvider } from '@novu/providers';
const novu = new NovuStateless();
await novu.registerProvider(
new SendgridEmailProvider({
apiKey: process.env.SENDGRID_API_KEY,
from: 'sender@mail.com',
}),
);
const passwordResetTemplate = await novu.registerTemplate({
id: 'password-reset',
messages: [
{
subject: 'Your password reset request',
channel: ChannelTypeEnum.EMAIL,
template: `
Hi {{firstName}}!
To reset your password click <a href="{{resetLink}}">here.</a>
{{#if organization}}
<img src="{{organization.logo}}" />
{{/if}}
`,
},
],
});
await novu.trigger('<REPLACE_WITH_EVENT_NAME>', {
$user_id: '<USER IDENTIFIER>',
$email: 'test@email.com',
firstName: 'John',
lastName: 'Doe',
organization: {
logo: 'https://evilcorp.com/logo.png',
},
});
Providers
Novu provides a single API to manage providers across multiple channels with a simple-to-use interface.
- <input checked="" disabled="" type="checkbox"> Sendgrid
- <input checked="" disabled="" type="checkbox"> Netcore
- <input checked="" disabled="" type="checkbox"> Mailgun
- <input checked="" disabled="" type="checkbox"> SES
- <input checked="" disabled="" type="checkbox"> Postmark
- <input checked="" disabled="" type="checkbox"> Custom SMTP
- <input checked="" disabled="" type="checkbox"> Mailjet
- <input checked="" disabled="" type="checkbox"> Mandrill
- <input checked="" disabled="" type="checkbox"> SendinBlue
- <input disabled="" type="checkbox"> SparkPost
📞 SMS
- <input checked="" disabled="" type="checkbox"> Twilio
- <input checked="" disabled="" type="checkbox"> Plivo
- <input checked="" disabled="" type="checkbox"> SNS
- <input checked="" disabled="" type="checkbox"> Nexmo - Vonage
- <input checked="" disabled="" type="checkbox"> Sms77
- <input checked="" disabled="" type="checkbox"> Telnyx
- <input checked="" disabled="" type="checkbox"> Termii
- <input checked="" disabled="" type="checkbox"> Gupshup
- <input disabled="" type="checkbox"> Bandwidth
- <input disabled="" type="checkbox"> RingCentral
📱 Push
- <input checked="" disabled="" type="checkbox"> FCM
- <input checked="" disabled="" type="checkbox"> Expo
- <input disabled="" type="checkbox"> SNS
- <input disabled="" type="checkbox"> Pushwoosh
👇 Chat
- <input checked="" disabled="" type="checkbox"> Slack
- <input checked="" disabled="" type="checkbox"> Discord
- <input disabled="" type="checkbox"> MS Teams
- <input disabled="" type="checkbox"> Mattermost
📱 In-App
- <input checked="" disabled="" type="checkbox"> Novu
Other (Coming Soon...)
- <input disabled="" type="checkbox"> PagerDuty