Layouts is the name given to an entire notification template. This is the place where reusable components of notifications (partials) are pulled together, and the data structure for a notification payload is defined.
Each directory within ./layouts/
defines an individual template. They must include the following files:
At least one template file following the format <template-type>.handlebars
e.g. html.handlebars
|| txt.handlebars
. Within this file the code should follow Handlebars.js
syntax, if you're not familiar you can find the docs here. An example is shown below:
A model.ts
file that includes:
- an
IModel
interface describing the data needed for your template. - an array of sample data of type
IModel
to be used in template validation scripts - an annotation of the
IModel
interface to help generate a json schema using the sample data
/**
* Specify required object
*
* @examples require(".").sampleData
*/
export interface IModel {
name: string;
username: string;
requestDateTime: string;
}
export const sampleData: IModel[] = [
{
name: 'tim',
username: 'tim@rocketmakers.com',
requestDateTime: 'Valid date time',
},
];
In order to consume/utilise a layout it must be included under the "layouts"
property in a <provider>.json
at the root of your template repository. See providerJson.md for details on this process.