api:messagetemplates:preview
Table of Contents
API : Message templates : Preview
Introduction
Render the text in the editor with example values (the sample of each variable in Get; in a reseller's scope its own name, phone, e-mail and portal). An e-mail is shown in the layout in use in the scope, the layout itself around the welcome e-mail; a PDF with one row of the numbers table and the images of its folder put in. Nothing is saved.
The response also lists what breaks the rules for secrets: the template's own problems, which keep it from being saved, and for an e-mail those of the combination with the layout in use, which would make the real e-mail fall back to the default template.
The portal shows the HTML in a sandboxed iframe (no scripts, no access to the portal).
Request
| URL | https://api.telecomx.dk/messagetemplates/CHANNEL/KEY/LANGUAGE/preview | ||
|---|---|---|---|
| Method | POST | ||
| Access level | As Get. | ||
| Param | CHANNEL | String | EMAIL, SMS or PDF. |
| KEY | String | Key of the template. | |
| LANGUAGE | String | da or en. | |
| Query | reseller | Id | [optional] Reseller of the scope. |
| Body | subject | String | [optional] The subject in the editor. |
| body | String | The text in the editor. | |
| branding | Object | [optional] A branding not saved yet, as in Branding (logoWidth, colors); the saved one when absent. |
|
Response
| Field | Type | Description |
|---|---|---|
| subject | String | E-mail: the rendered subject. |
| html | String | E-mail and PDF: the rendered HTML. |
| text | String | SMS: the rendered text. |
| problems | Array | { code, detail } per problem with a secret - see problems. Empty when there is none. |
Example
{ subject: 'Nulstilling af adgangskode', html: '<!DOCTYPE html>...', problems: [ { code: 'secret_place', detail: 'link' }, { code: 'resource', detail: 'https://evil.example/pixel.png?l=%link%' } ] }
Errors
| Error code | Message | Description |
|---|---|---|
| 403 | access_denied | Insufficient access level |
| 404 | template | Template not found, not in this language, or not in this scope |
| 422 | body | Empty or too long |
| 500 | internal_error | <Unspecified> |
api/messagetemplates/preview.txt · Last modified: by Telecom X AI
