NextSign API
Email Templates

Preview a Message Template

See a template's texts as sent, and an SMS's exact length, parts and cost, with POST /v3/api/message-templates/preview.

POST https://api.nextsign.dk/v3/api/message-templates/preview

What 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.

curl --request POST 'https://api.nextsign.dk/v3/api/message-templates/preview' \
  --header "Authorization: Bearer $NEXTSIGN_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "template": {
      "type": "sms",
      "sms": { "body": "Hej {recipient_name} โ€“ husk at underskrive {case_name} ๐Ÿ‘" }
    },
    "situation": "signing",
    "values": { "recipient_name": "Henrik Bรธrgesen", "case_name": "Lejekontrakt" }
  }'

Request

PropertyMeaning
idA saved template. Give id or template
templateUnsaved texts: type, language and the settings block, as for create. Letters are not read
situationOnly this send: signing (the invitation), read, approve, reminder or allSigned. Default: all five
valuesValues 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. For the SMS above:

{
  "type": "sms",
  "language": "da",
  "preview": {
    "signing": {
      "text": "Hej Henrik Bรธrgesen โ€“ husk at underskrive Lejekontrakt ๐Ÿ‘\n\n www.nextsign.dk/r/1a2b3c4d\n\nDenne besked kan ikke besvares.",
      "encoding": "UCS-2",
      "characters": 119,
      "parts": 2,
      "charactersPerPart": 67,
      "charactersLeftInLastPart": 15,
      "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" }
  ]
}

The dash โ€“ and the emoji make this SMS UCS-2, so it needs 2 parts. With a hyphen - and without the emoji it is GSM-7, fits in 1 part and costs 0.1 credits. See characters, parts and cost.

Per type

TypeEach situation has
SMStext: the SMS exactly as sent (the link added when the text has no {recipient_url}, and the footer). Also encoding, characters, parts, charactersPerPart, charactersLeftInLastPart, nonGsmCharacters, doubleCountedCharacters and credits. usesStandardText or usesTextOf: "signing" says where the text came from
E-mailsubject, title, body, button that have text. For the other situations, emptyFieldsUse says what an empty field sends, and usesStandardText is set when the situation has no text of its own. Also sender (name, email)
e-BoksinboxTitle (inboxTitleFrom: situation, template, or case when the title falls back to the case title), button (null when hidden) and letter: which letter is sent (main, the situation's own, or null for documents directly)

unfilled lists placeholders that no value filled. They are sent as written unless the case has a document field with that key. placeholders lists every placeholder your company can use, including your own global fields.