Appearance
Email templates
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.
- The first one is a generic email to notify a recipient, e.g. that they’ve received a document.
- 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 name | Description |
---|---|
id | Is set by Cling after Post, numeric id of the email template. Read only. |
name | Optional internal name for the template |
type | The 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. |
parser | Optional parser to enable templating and to bind variables in the email template. The value hbs is for handlebars. |
data | A string with the email template data. |
createdAt | Read only. |
updatedAt | Read 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 name | Type | Description |
---|---|---|
subject | String | Email subject |
String | The recipient email | |
content | String | A text description the purpose of the email and how to view the document. |
link | Object | The main link for the client to view their document.href : String with a valid URL to view the documenttext : The link text like “Show document” |
document | Object | Complete JSON object of the document, example document.data.name can be used to show the document name (if specified) |
clientFirstName | String | The first name of the client (if specified) |
client | Object | The client object (contains properties like name or email ) |
company | Object | The company object, example company.name can be used to show the sender company name (if specified). |
logoUrl | String | Url to the sender logo (if any) |
unsubscribeUrl | String | URL to unsubscribe from any further emails from the sender company |
brand | String | Which brand that is used in the template (cling) |
language | String | Language that is used in the template (ISO 639, sv or en) |
year | Number | The current year like 2025 |
templateType | String | The type of template used, example document |
Document confirmation with PDF email template variables
Variable name | Type | Description |
---|---|---|
subject | String | Email subject |
String | The recipient email | |
title | String | A text title for the email |
textConfirmation | String | A text about the confirmation |
documentLink | Object | The main link for the client to view their document.href : String with a valid URL to view the documenttext : The link text like “Show document” |
pdfLink | Object | The link for the client to view their document as a PDF.href : String with a valid URL to view the documenttext : The link text like “Show PDF” |
magicLink | Object | The 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 documentpre : A pre text like “View all your documents on”text : The link text like “your pages” |
textAttachment | String | A text about that the PDF is attached to the email. |
document | Object | Complete JSON object of the document, example document.data.name can be used to show the document name (if specified) |
client | Object | The client object |
company | Object | The company object, example company.name can be used to show the sender company name (if specified). |
brand | String | Which brand that is used in the template |
language | String | Which language that is used in the template (ISO 639) |
year | Number | The current year like 2025 |
templateType | String | The type of template used, example clientPdf |