Notifire通知管理簡化
Notifire 是一個開源庫,用于使用單個 API 管理多渠道事務通知。為 Node.js 構建的簡單易用的 OCL,易于使用的模板,不再有供應商鎖定,統(tǒng)一的 API。
目標是簡化通知并為開發(fā)人員提供工具以在系統(tǒng)與其用戶之間創(chuàng)建有意義的通信。
特性:
- 適用于所有消息傳遞提供商的單一 API(電子郵件、短信、推送、直接)
- 輕松管理多個渠道的通知
- 配備用于高級布局和設計的模板引擎
- 缺失變量的內置保護
- 易于設置和集成
- 用 TypeScript 編寫,具有可預測的靜態(tài)類型。
- 社區(qū)驅動
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' } });
評論
圖片
表情
