Skip to content

Email templates

Partner email-template

When a document is sent to a recipient by email Cling will send out an email to the recipient with a link. If you’d like you can modify the appearance of the emails. There are two email templates that Cling uses and you can provide your own email templates to override them.

  1. The first one is a generic email to notify a recipient, e.g. that they’ve received a document.
  2. The second template is a signature receipt email.

Routes

You can use the following routes to customize the email templates to your own choosing.

GET /partner/emailTemplate Get the email templates for the authenticated partner.

GET /partner/emailTemplate/:id Get a email template by id (replace :id with the numeric id).

POST /partner/emailTemplate Create a new email template.

PUT /partner/emailTemplate/:id Update a email template by id. Only the properties specified are updated.

DELETE /partner/emailTemplate/:id Delete a email template by id

PATCH /partner/emailTemplate/:id Undo delete a email template by id

POST /partner/emailTemplate/:id/render Try to render html for a email template by id and bind data from body on the format { "data": { "name": "Test" } } Useful to test to render a specific template to verify how the html would be built.

Email template properties

The model for a email template have these properties:

json
{
  "id": 1,
  "name": "Template for documents",
  "type": "html",
  "parser": "hbs",
  "data": "<html>The email template contents</html>",
  "createdAt": "2022-11-16T13:10:21.000Z",
  "updatedAt": "2022-11-16T13:10:21.000Z"
}
Property nameDescription
idIs set by Cling after Post, numeric id of the email template. Read only.
nameOptional internal name for the template
typeThe type of data the email template is saved as. Valid values are html or mjml. html means that valid HTML should be stored in data, mjml means that a valid MJML template should be stored in data.
parserOptional parser to enable templating and to bind variables in the email template. The value hbs is for handlebars.
dataA string with the email template data.
createdAtRead only.
updatedAtRead only.

Email template variables

When a email template is rendered with hbs (handlebars) as parser you can bind variables and apply your own template logic as needed.

Example

Show the current year in the footer instead of a static number.

html
<>{{year}}</>

These are the variables that can be used in the template during render:

Document email template variables

Variable nameTypeDescription
subjectStringEmail subject
emailStringThe recipient email
contentStringA text description the purpose of the email and how to view the document.
linkObjectThe main link for the client to view their document.
href: String with a valid URL to view the document
text: The link text like “Show document”
documentObjectComplete JSON object of the document, example document.data.name can be used to show the document name (if specified)
clientFirstNameStringThe first name of the client (if specified)
clientObjectThe client object (contains properties like name or email)
companyObjectThe company object, example company.name can be used to show the sender company name (if specified).
logoUrlStringUrl to the sender logo (if any)
unsubscribeUrlStringURL to unsubscribe from any further emails from the sender company
brandStringWhich brand that is used in the template (cling)
languageStringLanguage that is used in the template (ISO 639, sv or en)
yearNumberThe current year like 2025
templateTypeStringThe type of template used, example document

Document confirmation with PDF email template variables

Variable nameTypeDescription
subjectStringEmail subject
emailStringThe recipient email
titleStringA text title for the email
textConfirmationStringA text about the confirmation
documentLinkObjectThe main link for the client to view their document.
href: String with a valid URL to view the document
text: The link text like “Show document”
pdfLinkObjectThe link for the client to view their document as a PDF.
href: String with a valid URL to view the document
text: The link text like “Show PDF”
magicLinkObjectThe link for the client to view their all document connected to their email on “my pages”.
href: String with a valid URL to view the document
pre: A pre text like “View all your documents on”
text: The link text like “your pages”
textAttachmentStringA text about that the PDF is attached to the email.
documentObjectComplete JSON object of the document, example document.data.name can be used to show the document name (if specified)
clientObjectThe client object
companyObjectThe company object, example company.name can be used to show the sender company name (if specified).
brandStringWhich brand that is used in the template
languageStringWhich language that is used in the template (ISO 639)
yearNumberThe current year like 2025
templateTypeStringThe type of template used, example clientPdf