Update template
Description
Add a new message template.
Request URL
Method: POST
https://example.com/api/v1.1/templates/update
Request parameters
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
format | string | "json" | No | Response data format By default– json |
id | int | 1 | Yes | Template ID |
name | string | "Subscription confirmation template" | Yes | Template name |
descr | string | "Template used in Double Opt-In scenario" | No | Template description |
channels | []channels | "channels": [ | Yes | Template settings for a certain channel. Learn more |
json_url | string | "https://altcraft.com/public/assets/example/test.json" | No | Link to dynamic JSON content |
ui_tags | [string] | ["tag_1","tag_2"] | No | List of tags |
groups | [int] | [1,2] | No | List of group IDs |
is_draft | bool | false | No | Draft template flag. If this is a draft, the template cannot be sent. |
is_confirm | bool | true | No | Confirm subscription link flag. Is there a confirmation link in the body of the email or not. |
suppress_id | int | 2 | No | Suppression list ID |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"id": 10,
"name": "Название шаблона",
"descr": "Описание шаблона",
"channels": [
{
"sid": "email",
"fields": {
"text": "Текстовая версия письма",
"html": "<html>Hello, world!</html>",
"subject": "Шаблон сообщения",
"from_email": "",
"from_name": "",
"replyto_email": "",
"replyto_name": "",
"is_not_inline": true
}
}
],
"json_url": "https://altcraft.com/public/assets/example/test.json",
"ui_tags": ["tag_1", "tag_2"],
"groups": [],
"is_draft": false,
"is_confirm": false,
"suppress_id": 4
}
<xml>
<channels array = 'true'>
<fields>
<body>Hello, world!</body>
<click_url>https://example.com</click_url>
<icon>https://example.com/images/picture.jpg</icon>
<title>Welcome</title>
</fields>
<sid>push</sid>
</channels>
<descr>Template description</descr>
<groups>1</groups>
<groups>2</groups>
<is_confirm>false</is_confirm>
<is_draft>false</is_draft>
<json_url>https://altcraft.com/example/message.json</json_url>
<id>10</id>
<name>Template</name>
<suppress_id>2</suppress_id>
<token>abcdefghijklmnqrstuvwxyz</token>
<ui_tags>tag_1</ui_tags>
<ui_tags>tag_2</ui_tags>
</xml>
Response example
- JSON
- XML
{
"data": {
"saved_id": 10
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<saved_id>10</saved_id>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>
Response parameters
Parameter | Type | Description |
---|---|---|
error | int | Error code |
error_text | string | Error text |
saved_id | string | Updated template ID |