Application-level templates

Render template as HTML

Changed on

Renders the HTML content of an application-level template using the provided variables and specified templating engine.

post/v3/templates/render

Request

  • Base URL
    https://api.us.nylas.com
  • Auth
    HTTP bearer

Request body

bodystring required

The body content of the template, in HTML format.

engine'handlebars' | 'mustache' required

The templating engine to use.

strictboolean

When true, Nylas returns an error if the template contains variables that aren't defined in the variables object.

variablesobject required

A set of key/value pairs representing variables to substitute for values in the template.

Example request

{
  "body": "<p>Hello {{user.name}}, this shows test was {{ foo }}.</p>",
  "engine": "mustache",
  "strict": true,
  "variables": {
    "user": {
      "name": "Leyah",
      "surname": "Miller"
    },
    "foo": "testing successful"
  }
}

Response

Success. Returns rendered HTML.

request_idstring required

The ID of the request.

Example response

{
  "request_id": "3907012912-13b5a9a4-f136-4761-a31b-68c6a8af825d",
  "data": {
    "body": "<p>Hello Leyah, your booking has been confirmed.</p>"
  }
}

Changes

    • breaking

      removed the enum value nunjucks of the request property

    • breaking

      removed the enum value twig of the request property