v0.2.5
版本发布时间: 2021-11-06 18:08:41
novuhq/novu最新发布版本:v0.24.0(2024-03-18 17:44:43)
What's Changed
- New Amazon SES email provider by @ulentini in https://github.com/notifirehq/notifire/pull/72
- New Mandrill Provider Added by @diganta413 in https://github.com/notifirehq/notifire/pull/63
- Custom template function by @davidsoderberg in https://github.com/notifirehq/notifire/pull/85
- Add SNS sms provider by @Wyfy0107 in https://github.com/notifirehq/notifire/pull/87
- Validator for trigger variables on the message level by @davidsoderberg in https://github.com/notifirehq/notifire/pull/91
Other changes
- Typo fixed by @tonytangdev in https://github.com/notifirehq/notifire/pull/81
Custom template function
In some cases, if you want to use your own template engine and not the built handlebars compiler, you can pass a function as the template
in the message object.
await templateStore.addTemplate({
id: 'test-notification-promise',
messages: [
{
subject: '<div>{{firstName}}</div>',
channel: ChannelTypeEnum.EMAIL,
template: (trigger: ITriggerPayload) => {
return `Custom rendered HTML`
}
},
],
});
Validate trigger variables
From this version, you can run a validator for the ITriggerPayload
passed to each message.
class JoiValidator extends IMessageValidator {
constructor(private joiSchema) {}
async validate(payload) {
const { error } = this.joiSchema.validate(payload);
if (error) throw new Error(error);
return true;
}
}
await templateStore.addTemplate({
id: 'test-notification-promise',
messages: [
{
validator: new JoiValidator(Joi.object({
firstName: Joi.string(),
lastName: Joi.string().required(),
})),
subject: '<div>{{firstName}}</div>',
channel: ChannelTypeEnum.EMAIL,
template: `Template`
},
],
});
New Contributors
- @ulentini made their first contribution in https://github.com/notifirehq/notifire/pull/72
- @tonytangdev made their first contribution in https://github.com/notifirehq/notifire/pull/81
- @davidsoderberg made their first contribution in https://github.com/notifirehq/notifire/pull/85
- @diganta413 made their first contribution in https://github.com/notifirehq/notifire/pull/63
- @Wyfy0107 made their first contribution in https://github.com/notifirehq/notifire/pull/87
Full Changelog: https://github.com/notifirehq/notifire/compare/v0.2.4...v0.2.5