What's Changed
- New Amazon SES email provider by @ulentini in #72
- New Mandrill Provider Added by @diganta413 in #63
- Custom template function by @davidsoderberg in #85
- Add SNS sms provider by @Wyfy0107 in #87
- Validator for trigger variables on the message level by @davidsoderberg in #91
Other changes
- Typo fixed by @tonytangdev in #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 #72
- @tonytangdev made their first contribution in #81
- @davidsoderberg made their first contribution in #85
- @diganta413 made their first contribution in #63
- @Wyfy0107 made their first contribution in #87
Full Changelog: v0.2.4...v0.2.5