User Tools

Site Tools


api:messagetemplates

API : Message templates

The e-mails, SMS and PDF documents the system sends are made from templates. They can be edited in the portal: Telecom X staff edit the master templates (Administration > System > Skabeloner), and a reseller can make its own version of the templates its customers receive and set its branding - logo and colours of the e-mails (Forhandler > Branding og skabeloner). The senders are unchanged; see also sendmail and sendsms.

Which template is used

A template is looked up in this order, the first found is used:

  1. the reseller's own version (MessageTemplates, reseller = the reseller)
  2. the master template (MessageTemplates, reseller null)

Every template the system sends has a master version. It can be changed, or an older version loaded from its history, but not deleted. A template that is new in the system has no master version until it is written in the editor: List marks it with masterMissing, and Get returns template null, so the editor opens it empty. Its messages are not sent before the master is saved - a reseller's customers get them if the reseller has made its own version.

A template that does not exist in English is sent in Danish. Reverting a reseller's version makes the master apply again; every replaced or reverted version is kept (MessageTemplateRevisions, 50 per template). Edits reach every API process within a minute.

Passwords, pin codes, passkey links and reset links sent to Telecom X staff (RESELLER_ADMIN and ADMIN employees) always use the master template and layout, with their reseller's branding - see Secrets.

E-mail layout and branding

Most e-mail templates are a body (an HTML fragment) that is wrapped in the layout (key _layout), which holds <head>, the styles, the logo and %content% where the body goes. A style change is then made once, in the layout. A template that is a full HTML document (starting with <!DOCTYPE or <html>) is used as it is, without the layout.

The layout gets the reseller's branding (ResellerBrandings) as variables:

Variable Value
%brandLogo% <img> of the logo (on the image server, at twice the logo width), empty without a logo
%brandLogoUrl% URL of the logo, empty without a logo
%brandTextColor% Text colour, #505060 by default
%brandBackgroundColor% Background colour, #f8f8f8 by default
%brandLinkColor% Link colour, #5050a0 by default
%brandFooterColor% Colour of the small print at the bottom, #909090 by default
%subject% The e-mail's subject
%content% The e-mail's body - required in the layout
%language% da or en

Variables

E-mail and SMS templates use %name% placeholders, PDF templates {name} (or { name }). The variables a template can use are the ones the system gives it (listed by Get, with example values). Values are put in in one pass, so a value containing %other% comes out literally; a placeholder without a value is removed. In an SMS, a value with HTML in it (a tag, comment or entity - e.g. %messageLine%, which is a paragraph in the e-mail) is put in as plain text.

PDF documents

A PDF template is a complete HTML document, made into an A4 PDF each time the document is needed.

Template Document A reseller's own version
poa Power of attorney for number porting Used for the portings of the reseller's customers
invoice Invoice Used for the invoices of the reseller's customers. The invoice to a reseller itself always uses the master.
fsc FlexCare service case None - internal

Images must be on the image server - upload them with Images. Other addresses are not fetched, and JavaScript does not run. In the power of attorney, the part between {numbers} and {/numbers} is repeated for each number, and qrcode.png is the QR code made for each document. The invoice's { products } are table rows made by the system. Values typed by customers are HTML-escaped. PDF templates can be previewed, but not sent as a test.

Scope and access

Every request has an optional query parameter reseller: without it the request is about the master templates, with it about that reseller's own versions and branding.

Access level Master templates (no reseller) A reseller's own versions and branding
RESELLER - (403) Its own tree: the e-mails, SMS and PDF documents its customers receive, the layout, the branding
RESELLER_ADMIN E-mail and SMS. Read only: the layout, the templates carrying a secret and PDF As RESELLER, for any reseller
ADMIN Everything As RESELLER, for any reseller

Templates sent to the reseller itself, to other operators or internally (PlayMaker) have no reseller version.

Templates carrying a password, pin code or login link may be styled by resellers, but must keep to the rules for secrets: newEmployee, employeePasswordReset, employeePasswordResetLink, employeeHackedEmailLogin, iptvHackedEmailLogin, employeePasskeyEnrollLink, employeePinCodeReset, guestInvite, portingPOA (e-mail), and employeePasskeyEnrollLink, employeePinCodeReset, guestInvite (SMS).

Requests

API Description
Templates
List Every template of the scope, with which languages are edited
Get One template as in use, what it falls back to, its variables and history
Save Save the scope's version of a template
Revert Delete a reseller's version, so the master is used again
Revision One replaced version, to load into the editor
Preview Render a template with example values
Test Send a template with example values to yourself
Branding
Branding Get and save a reseller's logo width and colours, upload and delete its logo
Images Upload an image to use in a template
Rules
Secrets Where a password, code or login link may stand, and what an e-mail carrying one may load
api/messagetemplates.txt · Last modified: by Telecom X AI

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki