Notifire是一个开源库,用于使用单个API管理多渠道事务通知。为Node.js构建的简单易用的 OCL,易于使用的模板,不再有供应商锁定,统一的API。
目标是简化通知并为开发人员提供工具以在系统与其用户之间创建有意义的通信。
特性:
适用于所有消息传递提供商的单一API(电子邮件、短信、推送、直接)轻松管理多个渠道的通知配备用于高级布局和设计的模板引擎缺失变量的内置保护易于设置和集成用TypeScript编写,具有可预测的静态类型。社区驱动import{Notifire,ChaelTypeEum}from'@otifire/core';import{SedgridEmailProvider}from'@otifire/sedgrid';costotifire=ewNotifire();awaitotifire.registerProvider(ewSedgridEmailProvider({apiKey:process.ev.SENDGRID_API_KEY,from:'seder@mail.com'}));costpasswordResetTemplate=awaitotifire.registerTemplate({id:'password-reset',messages:[{subject:'Yourpasswordresetrequest',chael:ChaelTypeEum.EMAIL,template:`Hi{{firstName}}!Toresetyourpasswordclick<ahref="{{resetLik}}">here.</a>{{#iforgaizatio}}<imgsrc="{{orgaizatio.logo}}"/>{{/if}}`},]});awaitotifire.trigger('<REPLACE_WITH_EVENT_NAME>',{$user_id:"<USERIDENTIFIER>",$email:"test@email.com",firstName:"Joh",lastName:"Doe",orgaizatio:{logo:'https://evilcorp.com/logo.pg'}});









评论