Git Product home page Git Product logo

novuhq / novu Goto Github PK

View Code? Open in Web Editor NEW
32.5K 170.0 3.4K 203.89 MB

๐Ÿ”ฅ The open-source notification infrastructure with fully functional embedded notification center ๐Ÿš€๐Ÿš€๐Ÿš€

Home Page: https://novu.co

License: MIT License

TypeScript 93.77% JavaScript 1.57% Dockerfile 0.21% Shell 0.21% Handlebars 0.23% HTML 0.83% EJS 0.08% Vue 0.11% Python 2.72% Smarty 0.11% MDX 0.14% CSS 0.03%
notifications communication email sms push-notifications transactional javascript typescript nodejs notification-center

novu's Introduction

๐Ÿ‘จโ€๐Ÿ’ป We are hiring in Europe/UK/Israel! ๐Ÿ‘ฉโ€๐Ÿ’ป



NPM npm downloads MIT

The open-source notification infrastructure for developers

The ultimate service for managing multi-channel notifications with a single API.


Explore the docs ยป

Report Bug ยท Request Feature ยท Join Our Discord ยท Roadmap ยท X ยท Notifications Directory

Available in: Node.js ยท PHP ยท Go ยท Ruby ยท Kotlin ยท Elixir ยท Rust ยท Python ยท Java

โญ๏ธ Why Novu?

Novu provides a unified API that makes it simple to send notifications through multiple channels, including In-App, Push, Email, SMS, and Chat. With Novu, you can create custom workflows and define conditions for each channel, ensuring that your notifications are delivered in the most effective way possible.

โœจ Features

  • ๐ŸŒˆ Single API for all messaging providers (In-App, Email, SMS, Push, Chat)
  • ๐Ÿ’… Easily manage notifications over multiple channels
  • ๐Ÿš€ Equipped with a CMS for advanced layouts and design management
  • ๐Ÿ›ก Built-in protection for missing variables (Coming Soon)
  • ๐Ÿ“ฆ Easy to set up and integrate
  • ๐Ÿ›ก Debug and analyze multi-channel messages in a single dashboard
  • ๐Ÿ“ฆ Embeddable notification center with real-time updates
  • ๐Ÿ‘จโ€๐Ÿ’ป Community-driven

๐Ÿ“š Table Of Contents

๐Ÿš€ Getting Started

We are excited to launch the complete Novu API and admin panel. Do you want to give it a test before the official release? Here is how:

npx novu init

After setting up your account using the cloud or docker version, you can trigger the API using the @novu/node package.

For API documentation and reference, please visit [Novu API Reference] (https://docs.novu.co/api-reference/events/trigger-event?utm_campaign=github-readme).

To get started with the Node.js package, you can install it using npm:

npm install @novu/node
import { Novu } from '@novu/node';

const novu = new Novu(process.env.NOVU_API_KEY);

await novu.trigger('<TRIGGER_NAME>', {
  to: [
    {
      subscriberId: '<UNIQUE_IDENTIFIER>',
      email: '[email protected]',
      firstName: 'John',
      lastName: 'Doe',
    },
  ],
  payload: {
    name: 'Hello World',
    organization: {
      logo: 'https://happycorp.com/logo.png',
    },
  },
});

GitOps & React Email Integration

Create notification workflows right from your IDE and integrate with MJML/React Email/Maizzle and others

  • Fully managed GitOps Flow, deployed from your CI
  • Local Dev Studio to develop and debug workflows in your IDE
  • React Email/Maizzle/MJML integrations
  • Runs in your VPC
  • Debug cloud triggers in your IDE
  • Type safety with your favorite programming language
  • Define workflow and step validations with Zod or JSON Schema
  • Modify content and behavior via Web management input panel

Request Early Access

client.workflow('comment-on-post', async ({step, subscriber}) => {
  const inAppResponse = await step.inApp('in-app-step', async (inputs) => {
    return {
      // body: renderReactComponent(inputs)
    };
  }, {
    inputs: {
      // ...JSON Schema or ZOD/Ajv/Class Validators definition
    }
  });

  // Novu Worker Engine will manage the state and durability of each step in isolation
  const {digestedEvents} = await step.digest('1 day');

  await step.email('email-step', async () => {
    return {
      subject: 'E-mail Subject',
      body: renderReactEmail(<ReactEmailComponent events={digestedEvents} />);
    }
  }, {
    // Step-level inputs defined in code and controlled in the novu Cloud UI by a Non-Technical Team member
    inputs: {
      // ...JSON Schema
    },
    providers: {
      sendgrid: async (inputs) => {
        // Echo runs as part of your application, so you have access to your database or resources

        return {
          to: email,
          ipPoolName: 'custom-pool'
        };
      }
    },
    skip: () => {
      // Write custom skip logic
      return inAppResponse.seen || subscriber.isOnline;
    }
  });
// Define your workflow trigger payload using json schema and custom validation;
}, {
  dataSchema: {
    // ...JSON Schema
  }
});

Embeddable Notification Center

Using the Novu API and admin panel, you can easily add a real-time notification center to your web app without building it yourself. You can use our React / Vue / Angular components or an iframe embed, as well as a Web component.

notification-center-912bb96e009fb3a69bafec23bcde00b0

Read more about how to add a notification center to your app with the Novu API here

React Component ยท Vue Component ยท Angular Component

Providers

Novu provides a single API to manage providers across multiple channels with a simple-to-use interface.

๐Ÿ’Œ Email

๐Ÿ“ž SMS

๐Ÿ“ฑ Push

๐Ÿ‘‡ Chat

๐Ÿ“ฑ In-App

Other (Coming Soon...)

  • PagerDuty

๐Ÿ“‹ Read Our Code Of Conduct

Before you begin coding and collaborating, please read our Code of Conduct thoroughly to understand the standards (that you are required to adhere to) for community engagement. As part of our open-source community, we hold ourselves and other contributors to a high standard of communication. As a participant and contributor to this project, you agree to abide by our Code of Conduct.

๐Ÿ’ป Need Help?

We are more than happy to help you. If you are getting any errors or facing problems while working on this project, join our Discord server and ask for help. We are open to discussing anything related to the project.

โšก Immediate working space with Gitpod

Open in Gitpod

๐Ÿ”— Links

๐Ÿ›ก๏ธ License

Novu is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ’ช Thanks To All Contributors

Thanks a lot for spending your time helping Novu grow. Keep rocking ๐Ÿฅ‚

Contributors

novu's People

Contributors

abhilipsasahoo03 avatar ainouzgali avatar akshitagupta15june avatar alexvcs avatar aliaksandrryzhou avatar antonjoel82 avatar biswaviraj avatar chavda-bhavik avatar cliftonz avatar combarnea avatar davidsoderberg avatar deepsource-autofix[bot] avatar djabarovgeorge avatar firassziedan avatar gitstart avatar jainpawan21 avatar letitrock avatar michaldziuba03 avatar p-fernandez avatar parveshsaini avatar peoray avatar raikasdev avatar renovate[bot] avatar rifont avatar scopsy avatar sumitsaurabh927 avatar tnajanssen avatar unicodeveloper avatar vannyle avatar venarius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

novu's Issues

Filter message level

  • I'm submitting a ...
    [ ] bug report
    [X] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

  • Add option to add filters to message level, add operators like gt, lt, eq, and such

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Add new postmark provider

What?

New Postmark Email Provider

Why?

To have the ability to use Postmark as a provider.

How?

Add new provider based on this guide

Usage

Example for Postmark provider registration needs to be finalized.

await notifire.registerProvider(
  new PostmarkProvider({
    apiKey: process.env.POSTMARK_API_KEY
  })
);

Add Mailjet email provider

What?

New [Mailjet](https://github.com/mailjet/mailjet-apiv3-nodejs Email Provider

Why?

To have the ability to use Mailjet as a provider.

How?

Add new provider based on this guide

Usage

Example for Mailjet provider registration needs to be finalized.

await notifire.registerProvider(
  new MailjetEmailProvider({
    from: "[email protected]",
    apiKey: process.env.MAILJET_API_KEY,
    secretKey: process.env.MAILJET_SECRET_KEY
  })
);

Notes

This blog by Ferenc Almasi can be used as reading material.

Add new SNS provider

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
New SNS SMS Provider

Describe the solution you'd like
A clear and concise description of what you want to happen.
use the aws sdk: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SNS.html

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

[NV-187] - Add input interface for In-App providers

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project
  • Summary
    Need to create output interface for In-App providers. The interface should be based on planned providers, properties are the common logic properties found on all/most.

Suggested example:

interface IInAppOptions {
    to: string | string[];
    html: string;
    from?: string;
    avatar?: string;
    redirect?: string;
}

Add new emailjs provider

What?

New emailjs Email Provider

Why?

To have the ability to use emailjs as a provider.

How?

Add new provider based on this guide

Usage

Example for emailjs provider registration needs to be finalized.

await notifire.registerProvider(
  new EmailJsProvider({
    from: "[email protected]",
    host: "smtp.test.email",
    port: 587,
    secure: false, // true for 465, false for other ports
    user: "userName", // generated ethereal user
    password: "password",
  })
);

Github actions tests pipeline

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Add the ability to run all unit tests on each commit and PR on GH.

[NV-189] - Add output interface for push providers

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project
  • Summary
    Need to create output interface for push providers. The interface should be based on planned providers, properties are the common logic properties found on all/most.

Suggested example:

interface IPushResoponse {
    id: string;
    status: IMessageResoponseStatus; 
}

Fix documentation edit link

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Currently clicking on "edit this page" on any of the links in our docs is directing to the wrong (previous) Github link, we need to update docusaurus config to the new path.

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Example

Wrong path - https://github.com/notifirehq/docs/tree/main/docs/community/contributing.md
Right path - https://github.com/notifirehq/notifire/blob/master/docs/docs/community/contributing.md

Describe and enforce patterns in our providers better (with TypeScript)

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [x] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    While using the project, I noticed that there are a few places where the typing information could be better. Enforcing some patterns is also possible by providing an abstract class to derive from, for example. Just wanted to bring these ideas up for discussion.

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
    I want to talk about a few things, so let me add numbers as a way to refer to the ideas:

I'm providing code context here so people can contribute to this issue/discussion without having to go through source.

export interface IProvider {
  id: string;
  channelType: ChannelTypeEnum;
}

export interface IEmailOptions {
  to: string | string[];
  subject: string;
  html: string;
  from?: string;
  text?: string;
}

export interface ISmsOptions {
  to: string;
  content: string;
  from?: string;
}

export interface IEmailProvider extends IProvider {
  channelType: ChannelTypeEnum.EMAIL;

  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  sendMessage(options: IEmailOptions): Promise<any>;
}

export interface ISmsProvider extends IProvider {
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  sendMessage(options: ISmsOptions): Promise<any>;

  channelType: ChannelTypeEnum.SMS;
}
  1. Our Providers are always tied to the ChannelTypeEnum. We could write the definition as:
export interface IProvider<C extends ChannelTypeEnum> {
  channelType: C;
}
export interface IEmailProvider extends IProvider<ChannelTypeEnum.EMAIL> {
  sendMessage(options: IEmailOptions): Promise<any>;
}
  1. In general, none of the properties of the provider and even options are supposed to be writable. so we could add readonly attributes to all properties so that it's clear and consumers of the API (at least in TypeScript) can't make mistakes like changing the channel type of a provider or the to address of an IEmailOptions.
export interface IProvider {
  readonly channelType: ChannelTypeEnum;
}
export interface ISmsOptions {
  readonly to: string;
  readonly content: string;
  readonly from?: string;
}

Another way to use records like ISmsOptions is to control consumers from not being able to edit them:

export interface ISmsProvider extends IProvider {
  sendMessage(options: Readonly<ISmsOptions>): Promise<any>;
}
  1. Provide a standard interface for configurations. As an example, in the PR #44 we have an EmailJsConfig interface:
export interface EmailJsConfig {
  from: string;
  host: string;
  port: number;
  secure: boolean;
  user: string;
  password: string;
}

We could provide an interface for API-based and SMTP-based email providers so that the shape of the configuration is consistent.

export interface EmailProviderConfig {
}
export interface SmtpBasedEmailProviderConfig extends EmailProviderConfig {
  from: string;
  host: string;
  port: number;
  secure: boolean;
  user: string;
  password: string;
}
export interface EmailJsConfig extends SmtpBasedEmailProviderConfig {
}
export interface NodeMailerConfig extends SmtpBasedEmailProviderConfig {
}
export interface ApiBasedEmailProviderConfig extends EmailProviderConfig {
  api_key: string;
}
export interface SendgridConfig extends ApiBasedEmailProviderConfig {
}
  1. Provide easy ways to enforce patterns with IProvider implementations.

For example, if we want to enforce usage of EmailProviderConfig, we can expose an abstract class for the same:

public abstract class ConfigBasedEmailProvider<E extends EmailProviderConfig> {
  constructor(protected config: E) {
  }
}

That would enable writing new config based providers easily. For example, the EmailJsProvider could've been written as:

public class EmailJsProvider extends ConfigBasedEmailProvider<EmailJsConfig> implements IEmailProvider {
  ..
}
  1. I would discourage returning Promise<any> - but I'd like to first understand why it's used. I think in most instances of current usage it can safely be Promise<void> if we don't care about the result but want to signal an async operation. Returning an any is pretty useless as the result always needs to be casted. Converting a result this way can be done by something like promise().then(() => {}). Combining this with idea 4 would mean we don't even need individual providers to write this code. They can return Promise<T> and we can always ensure the final return is a Promise<void>. Already taken care of in #41

  2. Some interfaces which are closed, could just be type aliases. Example:

type SmsOptions = {
  to: string;
  content: string;
  from?: string;
}

because we don't expect the options to be extended, whereas EmailProviderConfig in idea 3 is expected to be extended.

These ideas are composable. For example, combining the ideas 1, 3, and 4, we can write the EmailJsProvider as

public abstract class ConfigBasedEmailProvider<E extends EmailProviderConfig> implements IProvider<ChannelTypeEnum.EMAIL> {
  channelType: ChannelTypeEnum.EMail;
  constructor(protected config: E) {
 }
  abstract sendMessage(options: IEmailOptions): Promise<any>;
}
public class EmailJsProvider extends ConfigBasedEmailProvider<EmailJsConfig> {
  ..
}

Notice the lack of readonly since we didn't use idea 2.

These were my initial thoughts. Please let me know what you think.

Email Root Provider

What?

Adds the root Email provider every Email provider is encouraged to extend the root provider for mapping, error handling, and common jobs.

Why?

Give developers the ability to easily use provider input and output mapping, by creating map config, error handling maps, opposed to building everything.

How?

A new root Email provider with generic common methods for every provider to extend with extends keyword.

Usage

Needs to be finalized

[NV-186] - Move provider ID outside of provider implementation

Currently, the id is part of the provider implementation, this can cause duplication and limits the API user to register multiple providers from the same types but different keys.

The new API

notifire.registerProvider('<ID>', new SendgridEmailProvider({...}))

This removes the id key from the IProvider interface when implementing and attaching it only during registration.
Instead of the id under the provider, a new key name will be added to be used to distinguish different providers for logging purposes later.

The id in the registerProvider the method can be optional, and we can fall back to name on the provider as an id for simpler use-cases

Theming API

What?

Adds the ability to create theming configs (mainly for email and in-app). To create the basic look and feel layout for emails, element items.

Why?

Give developers the ability to easily switch themes for different customers and define them in a single place. Without specifying it with every message design.

How?

A new API will be provided for registering Themes and a default theme will be used for all messages unless specified otherwise.

Template registration and definition

const mainTheme = await notifire.registerTheme({
  id: 'main-theme',
  styling: {
      logo: "https://img.com/logo.png",
      
  },
  email: {
     layout: `
         <html>
             <head> </head>
             <body>
                  {{{body}}}
             </body>
         </html>
    `
  }
});

Usage

notifire.trigger('event-name', {
 ...trigerContent,
  $theme: 'theme-id', // When using default no need to specify
  $branding: { // specified only when wanting to override theme settings
      logo: '',
      colors: {

      }
  }
})

3rd party themes

Allow the ability to create user-generated themes, each theme will give the ability to specify variables for used customizations.

await notifire.registerTheme(
    new FunitoTheme({
       logo: '',
       headerImage: '',
       bannerColor: '',
       social: {
          facebook: ''
      }
   })
)

[NV-179] - Add new MailerSend provider

What?

New MailerSend Email Provider

How?

API documentation: www.developers.mailersend.com
Using the SDK: MailerSend Node.js.

Usage

Example for MailerSend provider registration needs to be finalized.

await notifire.registerProvider(
  new MailerSendProvider({
    apiKey: process.env.SPARKPOST_API_KEY
  })
);

I'm Agathe Brusset, project manager of MailerSend, a solution to send transactional emails via API or SMTP. We would love to connect MailerSend to Notifire. Would you consider integrating our solution into your app as an email provider?

Please find more details on our website: www.mailersend.com
Our API documentation: www.developers.mailersend.com

Let us know when you create yourselves an account so we can approve you.

Add output interface for email providers

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Need to create output interface for email providers. The interface should be based on current providers and planned providers, properties are the common logic properties found on all/most.

Suggested example:

interface IEmailResoponse {
    id: string;
    status: IMessageResoponseStatus; 
}

Template Schema Validation

  • I'm submitting a ...
    [ ] bug report
    [X] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Add for variable schema for templates

  • Add option for variable validation using Joi, Yup, class-validator, and such

  • Add option for a variable to fall back if missing of failing validation

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Add Variable Protection

  • I'm submitting a ...
    [ ] bug report
    [X] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

  • Add setting for protection for accidental trigger with missing variables

  • Set protection for accidental trigger by default to on

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Add text field for IEmailOptions

  • I'm submitting a ...
    [ ] bug report
    [X] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    For fallback, it is required for some providers to supply simple text (not HTML), this field is just for that.

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
    New field should be added to the interface called text

export interface IEmailOptions {
  to: string | string[];
  subject: string;
  html: string;
  from?: string;
  text?: string; // <- this is new
}

Add recommended knowledge to contributing article

  • I'm submitting a ...
    [ ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project
    [x] documentation update

  • Summary
    The contributing article is lacking recommended/suggested/required section, to align potential contributors on what's needed, and expected.

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Add livecycle hooks

  • I'm submitting a ...
    [ ] bug report
    [X] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Need to the ability to act based on hooks related to notification being sent

  • Add Pre-sent hook

  • Add Post-sent hook

  • Add Error hook

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Add Attachments Support

What?

Adds the ability to send attachments with email providers ts IEmailOptions.

Why?

Give developers the ability to add attachments to email providers, later on for push, direct, and in-app.

How?

Update email options interface, and later on update providers.

New Attachments Interface

interface IAttachmentOptions {
    attachmentType: 'url' | 'buffer';
    mime: string;
    path?: string;
    file?: Buffer;
    name?: string;
}

Usage

interface IEmailOptions {
    to: string | string[];
    subject: string;
    html: string;
    from?: string;
    attachments: IAttachmentOptions[];
}

Tasks

Provider support

Add lib unit tests

  • I'm submitting a ...
    [ ] bug report
    [X ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary

  • Template store tests

  • Transfer from ava to jest

  • Add Template Compile tests

  • Provider store test

  • Trigger tests

[NV-188] - Add output interface for In-App providers

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project
  • Summary
    Need to create output interface for In-App providers. The interface should be based on planned providers, properties are the common logic properties found on all/most.

Suggested example:

interface IInAppResoponse {
    id: string;
    status: IMessageResoponseStatus; 
}

[NV-180] - Add new SparkPost provider

What?

New SparkPost Email Provider

Why?

To have the ability to use SparkPost as a provider.

How?

Add new provider based on this guide

Usage

Example for SparkPost provider registration needs to be finalized.

await notifire.registerProvider(
  new SparkPostProvider({
    apiKey: process.env.SPARKPOST_API_KEY
  })
);

Add hooks docs

What?

Missing documentation for hooks

How?

Add missing doc, under templates in docs.
Templates location

Where?

Code can be found in TriggerEngine class

Add new SendinBlue provider

What?

New SendinBlue Email Provider

Why?

To have the ability to use SendinBlue as a provider.

How?

Add new provider based on this guide

Usage

Example for SendinBlue provider registration needs to be finalized.

await notifire.registerProvider(
  new SendinBlueProvider({
    apiKey: process.env.SENDINBLUE_API_KEY
  })
);

Missing docs for provider template command

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    A new provider template command was added in #61. Documentation is missing in how to add a provider

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions on how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

A new section with a title called initialization, description, and code snippet needs to be added.

[NV-183] - Add Whispir sms provider

What?

New Whispir SMS Provider, Whispir is one of the famous SMS providers here in Singapore.

Why?

To have the ability to use Whispir as a provider.

How?

Add new provider based on this guide

Usage

Example for Whispir SMS provider registration needs to be finalized.

await notifire.registerProvider(
  new WhispirSmsProvider({
    username: process.env.WHISPIR_USERNAME,
    password: process.env.WHISPIR_PASSWORD,
    apiKey: process.env.WHISPIR_API_KEY
  })
);

Add new Plivo provider

What?

New Plivo SMS Provider

Why?

To have the ability to use Plivo as a provider.

How?

Add new provider based on this guide

Usage

Example for Plivo provider registration needs to be finalized.

await notifire.registerProvider(
  new PlivoProvider({
    token: process.env.PLIVO_TOKEN,
    id: process.env.PLIVO_ID
  })
);

Allow custom template function or handlebars template syntax

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Give the ability to create template content based on user-defined functions and as well as handlebars.
    so changes will be as follows

interface IMessage {
  subject?: string;
  channel: ChannelTypeEnum;
  template: string | ((paras: any[]) => Promise<string> | string);  // <- this is updated from string
  active?: boolean | ((payload: ITriggerPayload) => Promise<boolean> | boolean);
}
  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Add output interface for SMS providers

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Need to create output interface for sms providers. The interface should be based on current providers and planned providers, properties are the common logic properties found on all/most.

Suggested example:

interface ISmsResoponse {
    id: string;
    status: IMessageResoponseStatus; 
}

Add new Nexmo provider

What?

New Nexmo SMS Provider

Why?

To have the ability to use Nexmo as a provider.

How?

Add new provider based on this guide

Usage

Example for Nexmo provider registration needs to be finalized.

await notifire.registerProvider(
  new NexmoProvider({
    apiKey: process.env.NEXMO_API_KEY
  })
);

Add new mandrill provider

What?

New Mandrill Email Provider

Why?

To have the ability to use Mandrill as a provider.

How?

Add new provider based on this guide

Usage

Example for Mandrill provider registration needs to be finalized.

await notifire.registerProvider(
  new MandrillProvider({
    apiKey: process.env.MANDRILL_API_KEY
  })
);

Create NestJS module wrapper

I'm submitting a ...

  • feature request

Summary

Add a module for NestJS, for nice and easy usage within NestJs based code-bases.

Module API

The initialization module should create a notifire instance registered with providers and templates. Accessing the module at a later stage should allow adding more templates and providers at run time.

import { NotifireModule } from "@notifire/nest";

@Module({
  imports: [
    NotifireModule.forRoot({
      providers: [
        new SendgridEmailProvider({
          apiKey: process.env.SENDGRID_API_KEY,
          from: "[email protected]",
        }),
      ],
      templates: [
        {
          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}}
      `,
            },
          ],
        },
      ],
    }),
  ],
})
export class CustomerModule {}

Injectable notifire instance

And @Injectable singleton service should be accessible in other nestjs services and modules.

@Injectable()
class UserService {
   constructor(private notifire: Notifire) {

   }

  async triggerEvent() {
      await this.notifire.trigger(.....)
   }
}

The new module can be added to packages/nest folder. Boilerplate for the package can be taken from running yarn run generate:provider and then copying the folder to the packages folder.

[NV-182] - Add Bandwidth sms provider

What?

New Bandwidth SMS Provider.

Why?

To have the ability to use Bandwidth as a provider.

How?

Add new provider based on this guide

Usage

Example for Bandwidth SMS provider registration needs to be finalized.

await notifire.registerProvider(
  new Bandwidth SmsProvider({
    username: process.env. BANDWIDTH_USERNAME,
    password: process.env.BANDWIDTH_PASSWORD,
    apiKey: process.env.BANDWIDTH_API_KEY
  })
);

Add new AWS SES email provider

What?

New SES Email Provider

Why?

To have the ability to use SES as a provider.

How?

Add new provider based on this guide

Usage

Example for SES provider registration needs to be finalized.

await notifire.registerProvider(
  new SESEmailProvider({
    from: "[email protected]",
    accessKeyId: process.env.SES_ACCESS_KEY,
    secretAccessKey: process.env.SES_SECRET_KEY,
    region: process.env.SES_REGION
  })
);

Notes

This blog by EJ Ozyazgan can be used as reading material, as well as this article by AWS team, or this blog post by Mac Lisowski(https://github.com/maclisowski).

SMS Root Provider

What?

Adds the root SMS provider every SMS provider is encouraged to extend the root provider for mapping, error handling, and common jobs.

Why?

Give developers the ability to easily use provider input and output mapping, by creating map config, error handling maps, opposed to building everything.

How?

A new root SMS provider with generic common methods for every provider to extend with extends keyword.

Usage

Needs to be finalized

Suggestion: separate providers from core

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    I think currently notifire core (pubsub system) and providers are all in the same package. I think to reduce bundle size and bloat-ness it would be great to separate providers to individual packages and make core package dependency independent.

import { Notifire } from '@notifire/core';
import { SomeProvider } from '@notifire/some-provider';

...

[NV-190] - Add input interface for Push providers

  • I'm submitting a ...
    [ ] bug report
    [x] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project
  • Summary
    Need to create output interface for push providers. The interface should be based on planned providers, properties are the common logic properties found on all/most.

Suggested example:

interface IPushOptions {
    to: string | string[];
    html: string;
    from?: string;
    avatar?: string;
    redirect?: string;
}

Add Node Mailer Provider

What?

New Node Mailer Email Provider

Why?

To have the ability to use Node Mailer, smtp as a provider.

How?

Add new provider based on this guide

Usage

Example for Node Mailer provider registration using smtp, need to be finalized.

await notifire.registerProvider(
  new NodeMailerProvider({
    from: "[email protected]",
    host: "smtp.test.email",
    port: 587,
    secure: false, // true for 465, false for other ports
    user: "userName", // generated ethereal user
    password: "password",
  })
);

Bug: ITheme and ITriggerPayload throws type errors with strict mode enabled

  • I'm submitting a ...
    [ x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    Calling const notifire = await new Notifire() with Typescript strict mode enabled causes type errors.

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Affected types are ITriggerPayload and ITheme Something like this fixes the problem:

export interface ITheme {
    branding: {
        mainColor?: string;
        logo?: string;
    } & CustomBranding
    emailTemplate: IEmailTemplate;
}
interface CustomBranding {
    [key: string]: string;
}

Errors:

node_modules/@notifire/core/build/main/lib/template/template.interface.d.ts:17:5 - error TS2411: Property '$email' of type 'string | undefined' is not assignable to 'string' index type 'string | number | boolean'.

17     $email?: string;
       ~~~~~~

node_modules/@notifire/core/build/main/lib/template/template.interface.d.ts:18:5 - error TS2411: Property '$phone' of type 'string | undefined' is not assignable to 'string' index type 'string | number | boolean'.

18     $phone?: string;
       ~~~~~~

node_modules/@notifire/core/build/main/lib/template/template.interface.d.ts:20:5 - error TS2411: Property '$theme_id' of type 'string | undefined' is not assignable to 'string' index type 'string | number | boolean'.

20     $theme_id?: string;
       ~~~~~~~~~

node_modules/@notifire/core/build/main/lib/theme/theme.interface.d.ts:3:9 - error TS2411: Property 'mainColor' of type 'string | undefined' is not assignable to 'string' index type 'string'.

3         mainColor?: string;
          ~~~~~~~~~

node_modules/@notifire/core/build/main/lib/theme/theme.interface.d.ts:4:9 - error TS2411: Property 'logo' of type 'string | undefined' is not assignable to 'string' index type 'string'. 

4         logo?: string;
        ```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.