SmsPreviewMessage¶
POST sms/message/preview
Renders a text without sending anything: what the recipient will read, which encoding it falls into, how many segments it costs, and which placeholders stayed unresolved.
This is the method behind the template editor. Segment count is the reason it exists: the difference between one and two segments is the difference between one and two invoices per recipient.
Access Control¶
Allowed roles: admin, leader, manager.
Request¶
POST https://{broker_domain}/sms/message/preview
{
"templateId": 4,
"data": {
"name": "John",
"amount": "250 EUR"
}
}
{
"command": "SmsPreviewMessage",
"extID": "1",
"data": {
"templateId": 4,
"data": {
"name": "John",
"amount": "250 EUR"
}
}
}
const res = await platform.SmsPreviewMessage({
templateId: 4,
data: {
name: "John",
amount: "250 EUR"
}
});
Request Data¶
| Field | Type | Required | Description |
|---|---|---|---|
templateId |
int | No | Template to render; use either this or message |
message |
string | No | Raw text to measure |
data |
object | No | Placeholder values |
truncate |
bool | No | Show the text truncated to [sms] maxParts |
Response Data¶
{
"text": "John, your deposit of 250 EUR is confirmed",
"encoding": "GSM7",
"length": 41,
"parts": 1,
"truncated": false,
"kind": "TRANSACTIONAL",
"placeholders": ["name", "amount"],
"missingPlaceholders": [],
"templateId": 4
}
Errors¶
| Code | Error | Description |
|---|---|---|
400 |
VALIDATION_ERROR |
Neither templateId nor message was provided |
404 |
TEMPLATE_NOT_FOUND |
Template not found in the brand |