Skip to content

Template Management

Managing templates can be done via the following endpoints by using the id from the notification type list call and a spcific provider type you want to manage

Available providerTypes

  • Sms
  • Email
  • PushNotification

Endpoints

Get /notification-types/{id}/templates/{providerType}

Post /notification-types/{id}/templates/{providerType}

Put /notification-types/{id}/templates/{providerType}

Delete /notification-types/{id}/templates/{providerType}

Example Body

1
2
3
4
5
6
7
8
{
  "templates": [
    {
      "template_type": "Subject",
      "value": "string"
    }
  ]
}

Available templateTypes

  • Subject
  • Body
  • AdditionalContext

Requirements

Sms

Only requires the Body template

Email

Requires the Subject and Body templates

PushNotification

Requires the Subject and Body templates with the AdditionalContext being optional.

The AdditionalContext needs to be in the form of an object and will be passed along with the push notification

Templating Engine

Templates are powered by Scriban

Example

Heres an example of what your template value would look like:

1
2
3
4
5
6
7
8
9
 <ul id='products'>
  {\{ for product in products }}
    <li>
      <h2>{\{ product.name }}</h2>
           Price: {\{ product.price }}
           {\{ product.description | string.truncate 15 }}
    </li>
  {\{ end }}
 </ul>

this will loop through a list of products displaying the product.name, product.price and product.description by truncating the length of the product.description by 15 characters