Grant-level templates

Render template as HTML

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

post/v3/grants/{grant_id}/templates/render

Request body

bodystring required

The body content of the template, in HTML format.

engine'handlebars' | 'mustache' | 'nunjucks' | 'twig' 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

No recorded changes to this endpoint across all 1 revision of this API.