0

GitHub - notifirehq/notifire: 🚀 The ultimate library for managing multi-channel...

 2 years ago
source link: https://github.com/notifirehq/notifire
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Notification management simplified.

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

Explore the docs »

Report Bug · Request Feature · Read our blog

star Why

Building a notification system is hard, at first it seems like just sending an email but in reality it's just the beginning. In today's world users expect multi channel communication experience over email, sms, push, direct and more... An ever growing list of providers are popping up each day, and notifications are spread around the code. Notifire's goal is to simplify notifications and provide developers the tools to create meaningful communication between the system and it's users.

sparkles Features

  • rainbow Single API for all messaging providers (Email, SMS, Push, Direct)
  • nail_care Easily manage notification over multiple channels
  • rocket Equipped with a templating engine for advanced layouts and designs
  • shield Built-in protection for missing variables
  • package Easy to set up and integrate
  • shield Written in TypeScript with predictable static types.
  • man_technologist Community driven

package Install

npm install @notifire/core
yarn add @notifire/core

hammer Usage

import { Notifire, ChannelTypeEnum } from '@notifire/core';
import { SendgridEmailProvider } from '@notifire/sendgrid';

const notifire = new Notifire();

await notifire.registerProvider(
  new SendgridEmailProvider({
    apiKey: process.env.SENDGRID_API_KEY,
    from: '[email protected]'
  })
);

const passwordResetTemplate = await notifire.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 notifire.trigger('<REPLACE_WITH_EVENT_NAME>', {
  $user_id: "<USER IDENTIFIER>",
  $email: "[email protected]",
  firstName: "John",
  lastName: "Doe",
  organization: {
    logo: 'https://evilcorp.com/logo.png'
  }
});

Providers

Notifire provides a single API to manage providers across multiple channels with a single to use interface.

love_letter Email

telephone_receiver SMS

iphone Push

  • Pushwoosh

link Links


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK