Preview an Email Template
See what an e-mail, SMS or e-Boks template sends, and an SMS's exact length, parts and cost, with POST /api/v2/{company}/emailTemplates/preview.
POST https://www.nextsign.dk/api/v2/{company}/emailTemplates/previewWhat a template sends, with its {placeholders} filled in. Preview a saved template by id, or try texts before you save them. Nothing is saved or sent.
Examples
The invitation of the e-mail template, for one recipient and case:
curl --request POST 'https://www.nextsign.dk/api/v2/{company}/emailTemplates/preview' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
--data '{
"id": "6731a2b4c5d6e7f8a9b0c1d3",
"situation": "signing",
"values": { "recipient_name": "Henrik Børgesen", "case_name": "Lejekontrakt Vestergade 4" }
}'200 OK. placeholders is trimmed here:
{
"type": "email",
"language": "da",
"preview": {
"signing": {
"subject": "Lejekontrakt til underskrift: Lejekontrakt Vestergade 4",
"title": "Din lejekontrakt er klar",
"body": "Kære Henrik Børgesen\n\nHer er lejekontrakten til underskrift. Læs den igennem, og underskriv med MitID.",
"button": "Læs og underskriv",
"unfilled": []
},
"sender": { "name": "Land & Plan A/S", "email": "noreply@nextsign.dk" }
},
"warnings": [],
"placeholders": [
{ "placeholder": "{recipient_name}", "description": "The recipient's name" },
{ "placeholder": "{recipient_email}", "description": "The recipient's e-mail address" }
// every placeholder your company can use
]
}The invitation of the SMS template with the emoji:
curl --request POST 'https://www.nextsign.dk/api/v2/{company}/emailTemplates/preview' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
--data '{
"id": "6731a2b4c5d6e7f8a9b0c1d2",
"situation": "signing",
"values": { "recipient_name": "Henrik Børgesen", "case_name": "Lejekontrakt" }
}'200 OK. placeholders is trimmed here:
{
"type": "sms",
"language": "da",
"preview": {
"signing": {
"text": "Hej Henrik Børgesen 👋 Underskriv Lejekontrakt her: www.nextsign.dk/r/1a2b3c4d\n\nDenne besked kan ikke besvares.",
"encoding": "UCS-2",
"characters": 111,
"parts": 2,
"charactersPerPart": 67,
"charactersLeftInLastPart": 23,
"nonGsmCharacters": ["👋"],
"doubleCountedCharacters": [],
"credits": 0.2,
"unfilled": []
}
},
"warnings": [],
"placeholders": [
{ "placeholder": "{recipient_name}", "description": "The recipient's name" },
{ "placeholder": "{recipient_email}", "description": "The recipient's e-mail address" }
// every placeholder your company can use
]
}text is the SMS exactly as sent: the link where {recipient_url} is, and the footer. The emoji makes it UCS-2, so 111 characters need 2 parts of at most 67 characters. Without it, the SMS is GSM-7, fits in 1 part and costs 0.1 credits.
To try a text before you save it, send template instead of id:
{
"template": {
"type": "sms",
"sms": { "body": "Hej {recipient_name}, underskriv {case_name} her: {recipient_url}" }
},
"situation": "signing"
}The reminder of the e-Boks template with a letter:
curl --request POST 'https://www.nextsign.dk/api/v2/{company}/emailTemplates/preview' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
--data '{
"id": "6731a2b4c5d6e7f8a9b0c1d5",
"situation": "reminder",
"values": { "case_name": "Matr. 12a" }
}'200 OK. placeholders is trimmed here:
{
"type": "eboks",
"language": "da",
"preview": {
"reminder": {
"inboxTitle": "Husk skelforretningen Matr. 12a",
"inboxTitleFrom": "situation",
"button": "Se dokumenterne",
"letter": "main"
}
},
"warnings": [],
"placeholders": [
{ "placeholder": "{recipient_name}", "description": "The recipient's name" },
{ "placeholder": "{recipient_email}", "description": "The recipient's e-mail address" }
// every placeholder your company can use
]
}inboxTitleFrom says where the title came from: situation (the reminder's own title), template, or case when the title falls back to the case title. letter is the letter that is sent: main, the situation's own, or null for documents directly.
Request
| Property | Meaning |
|---|---|
id | A saved template. Give id or template |
template | Unsaved texts: type, language and the settings block, as for create. Letters are not read |
situation | Only this send: signing (the invitation), read, approve, reminder or allSigned. Default: all five |
values | Values for placeholders, by key without braces. The rest get example values: your company's own name and details, the API key's user as sender, "Alex Jensen" as recipient |
Response
200 OK with preview (one entry per situation), warnings and placeholders: every placeholder your company can use, including your own global fields. What each type returns describes the fields per type.
unfilled lists placeholders that no value filled. They are sent as written, unless the case has a document field with that key.