Edit a text template
Overview
Change a template's message.
Use this to refine it, or send channel_id to attach it to a campaign's text channel. Get the channel id from data.data.channels[].id in the step 2 or step 3 response of Create or edit a campaign.
You'll need the template id and the new message. Every call also replaces landing_page_id and review_site_id: leave them out and they're cleared. name keeps its current value when you leave it out.
Editing a shared (global) template doesn't change it. A copy is saved under your account with a new
id, and the copy is returned (and attached tochannel_id). If your account already has a template with that name, the call returns400: send a differentname.
Returns the updated template.
Prerequisites
- A bearer token. See Authentication.
- The template's id (
sms_template_id), from List text templates. - Optional: a campaign channel id (
channel_id) to attach the template to.
Base URL
| Environment | URL |
|---|---|
| Production | https://production-api.shoutaboutus.com |
| Development | https://development-api.shoutaboutus.com |
Endpoint
POST /api/v1/campaign/template/sms/update
Authentication
Account token
sms_template_idmust be one of your account's templates or a shared (global) template; otherwise422.channel_id, when sent, must be a channel of a campaign on a location inside your own account tree; otherwise422.
Rate limit
This endpoint has no rate limit.
Request parameters
None.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
sms_template_id | integer | Yes | The template to edit (value in List text templates). Must be one of your account's templates or a shared template. |
content | string | Yes | The message text, with merge fields in square brackets such as [customerName], [landingPageUrl] and [locationName]. |
name | string | No | A new name for the template. Must be unique among your account's templates and the shared templates. Leave it out to keep the current name. |
channel_id | integer | No | A campaign channel to attach the template to; it becomes the channel's template. Must belong to a campaign on a location inside your account tree. |
landing_page_id | integer | No | The landing page template to link (value in List landing page templates). Must be one of your account's landing page templates or a shared one. Replaced on every call; leave it out to clear it. |
review_site_id | integer | No | A review site to link, by its id (value in List supported review sites). Replaced on every call; leave it out to clear it. |
Request payload
{
"sms_template_id": 469,
"content": "Hi [customerName], thanks for visiting [locationName]. Tell us how we did: [landingPageUrl] Reply STOP to opt out.",
"channel_id": 5394,
"landing_page_id": 4548
}Response body
The payload is inside data.
| Field | Type | Description |
|---|---|---|
status | string | success. |
message | string | SMS Template has been updated successfully! |
data | object | The saved template. For a shared template, this is your account's new copy. |
data.id | integer | The template's id. Use it as sms_template_id. |
data.name | string | The template's name. |
data.content | string | The message text, with merge fields in square brackets such as [customerName], [landingPageUrl] and [locationName]. |
data.landing_page_id | integer or null | The landing page template linked to this text, or null. |
data.review_site_id | integer or null | The review site linked to this text, or null. |
data.store_id | integer or null | The location the template is tied to, or null. |
Response payload
{
"data": {
"status": "success",
"message": "SMS Template has been updated successfully!",
"data": {
"id": 469,
"name": "Simple & Direct",
"content": "Hi [customerName], thanks for visiting [locationName]. Tell us how we did: [landingPageUrl] Reply STOP to opt out.",
"landing_page_id": 4548,
"review_site_id": null,
"store_id": 3007
}
}
}Examples
Success payload
See Response payload.
Error payload
400 Name already used by your account
{
"message": "Bad Request",
"status": "error",
"errors": {
"name": "A SMS template with this name already exists for your company. Please choose a different name for your SMS template."
}
}422 Not your template
{
"message": "The selected SMS template does not belong to your company.",
"errors": {
"sms_template_id": [
"The selected SMS template does not belong to your company."
]
}
}422 Channel outside your tree
{
"message": "The selected channel id does not belong to your company hierarchy.",
"errors": {
"channel_id": [
"The selected channel id does not belong to your company hierarchy."
]
}
}422 Name taken
{
"message": "The template name has already been taken.",
"errors": {
"name": [
"The template name has already been taken."
]
}
}422 Required fields missing
{
"message": "The sms template id field is required. (and 1 more error)",
"errors": {
"sms_template_id": [
"The sms template id field is required."
],
"content": [
"The content field is required."
]
}
}| Status | Meaning |
|---|---|
200 | The template was saved (for a shared template, as a new copy under your account). |
400 | You edited a shared template and your account already has a template with that name. |
401 | The token is missing, expired or invalid. |
422 | A required field is missing, the template or channel_id is outside your account, name is taken, or landing_page_id / review_site_id doesn't exist. |
500 | Unexpected server error. |
Example request
curl --request POST \
--url "https://production-api.shoutaboutus.com/api/v1/campaign/template/sms/update" \
--header 'Authorization: Bearer <bearer-token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"sms_template_id": 469, "content": "Hi [customerName], thanks for visiting [locationName]. Tell us how we did: [landingPageUrl] Reply STOP to opt out.", "channel_id": 5394, "landing_page_id": 4548}'Updated 17 days ago
