User Tools

Site Tools


api:messagetemplates:save

API : Message templates : Save

Introduction

Save the scope's version of a template: the master template, or a reseller's own version. The version it replaces is kept as a revision (MessageTemplateRevisions, the 50 newest per template). It is used by every API process within a minute. See messagetemplates.

A template carrying a password, pin code or login link is checked against the rules for secrets in the master layout, and the layout around an e-mail with one secret of each kind; one that breaks them is not saved (422 secrets). Preview lists what is wrong.

Request

URL https://api.telecomx.dk/messagetemplates/CHANNEL/KEY/LANGUAGE
Method PUT
Access level The template must be writable in the scope (writable in Get).
Param CHANNEL String EMAIL, SMS or PDF.
KEY String Key of the template.
LANGUAGE String da or en.
Query reseller Id [optional] Reseller whose own version is saved. Without it, the master template.
Body subject String E-mail: the subject, required, max 300 characters, with %variables%. Ignored for SMS, PDF and the layout.
body String The template, 1 - 200000 characters: HTML for e-mail and PDF, text for SMS. The layout must contain %content%.

Body example

{
  subject: 'Nulstilling af adgangskode',
  body: '<h2>Nulstil din adgangskode</h2>\n<p><a href="%link%" style="background:#c00; color:#fff; padding:10px 18px">Vælg ny adgangskode</a></p>'
}

Response

The template as after the save, in the format of Get.

Errors

Error code Message Description
403 access_denied The template is not writable in this scope
404 template Template not found, not in this language, or not in this scope
404 reseller Reseller not found
422 subject An e-mail needs a subject
422 body Empty or too long, or the layout lacks %content%
422 secrets A password, code or login link would not be safe in the template - see secrets. The message lists the problems in English.
500 internal_error <Unspecified>
api/messagetemplates/save.txt · Last modified: by Telecom X AI

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki