Skip to content

Create template version

Request

Create a new template versions.

By default the new version will not be active until it is activated with the activate endpoint. Alternatively, pass activate: true in the request body to create and activate the version in a single call. Doing so requires the communicator.template:activate permission in addition to communicator.template:create.

Security
oauth2(Required scopes: communicator.template:create) or bearerAuth or apiKeyHeader
Bodyapplication/jsonrequired

The new template

activateboolean

Only applies when creating a template version. If true, the newly created version is immediately set as the active version of its template descriptor, equivalent to calling the activate endpoint in a separate request.

Setting this to true requires the communicator.template:activate permission in addition to communicator.template:create. This field is ignored on update.

Default:false
contentHtmlTemplatestring or null(ContentHtmlTemplate)

A valid Jinja template to use for the content HTML body. This is used, for instance, for the body of an HTML email.

This is simply ignored when the channel does not need HTML content.

The context variables available to this template are the same as the context available to contentTextTemplate

Example:"Hello,<br/><p>{{foobar}}</p>"
contentTextTemplatestring or null(ContentTextTemplate)

A valid Jinja template to use for the content text body. This is used, for instance, for the body of a plain text email or text message.

Example:"Hello {{foobar}}"
descriptorIdstring(TemplateDescriptorId)TD-[A-Z0-9]{4}-[A-Z0-9]{4}

ID of the Template Descriptor

Example:"TD-AAAA-BBBB"
subjectLineTemplatestring or null(SubjectLineTemplate)

A valid Jinja template to use for the subject line. This is used, for instance, for the subject line when sending emails.

This is simply ignored when the channel does not need a subject.

The context variables available to this template are the same as the context available to contentTextTemplate

Example:"Hello {{foobar}}"
POST
/communicator/templates
curl -i -X POST \
  https://sandboxapi.peach.finance/api/communicator/templates \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "activate": false,
    "contentHtmlTemplate": "Hello,<br/><p>{{foobar}}</p>",
    "contentTextTemplate": "Hello {{foobar}}",
    "descriptorId": "TD-AAAA-BBBB",
    "subjectLineTemplate": "Hello {{foobar}}"
  }'

Responses

OK

Bodyapplication/json
idstring(TemplateVersionId)TV-[A-Z0-9]{4}-[A-Z0-9]{4}
Example:"TV-AAAA-BBBB"
activateboolean

Only applies when creating a template version. If true, the newly created version is immediately set as the active version of its template descriptor, equivalent to calling the activate endpoint in a separate request.

Setting this to true requires the communicator.template:activate permission in addition to communicator.template:create. This field is ignored on update.

Default:false
contentHtmlTemplatestring or null(ContentHtmlTemplate)

A valid Jinja template to use for the content HTML body. This is used, for instance, for the body of an HTML email.

This is simply ignored when the channel does not need HTML content.

The context variables available to this template are the same as the context available to contentTextTemplate

Example:"Hello,<br/><p>{{foobar}}</p>"
contentTextTemplatestring or null(ContentTextTemplate)

A valid Jinja template to use for the content text body. This is used, for instance, for the body of a plain text email or text message.

Example:"Hello {{foobar}}"
descriptorIdstring(TemplateDescriptorId)TD-[A-Z0-9]{4}-[A-Z0-9]{4}

ID of the Template Descriptor

Example:"TD-AAAA-BBBB"
subjectLineTemplatestring or null(SubjectLineTemplate)

A valid Jinja template to use for the subject line. This is used, for instance, for the subject line when sending emails.

This is simply ignored when the channel does not need a subject.

The context variables available to this template are the same as the context available to contentTextTemplate

Example:"Hello {{foobar}}"
Response
{ "id": "TV-AAAA-BBBB", "activate": false, "contentHtmlTemplate": "Hello,<br/><p>{{foobar}}</p>", "contentTextTemplate": "Hello {{foobar}}", "descriptorId": "TD-AAAA-BBBB", "subjectLineTemplate": "Hello {{foobar}}" }