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 to channel_id). If your account already has a template with that name, the call returns 400: send a different name.

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

EnvironmentURL
Productionhttps://production-api.shoutaboutus.com
Developmenthttps://development-api.shoutaboutus.com

Endpoint

POST /api/v1/campaign/template/sms/update

Authentication

Account token

  • sms_template_id must be one of your account's templates or a shared (global) template; otherwise 422.
  • channel_id, when sent, must be a channel of a campaign on a location inside your own account tree; otherwise 422.

Rate limit

This endpoint has no rate limit.

Request parameters

None.

Request body

FieldTypeRequiredDescription
sms_template_idintegerYesThe template to edit (value in List text templates). Must be one of your account's templates or a shared template.
contentstringYesThe message text, with merge fields in square brackets such as [customerName], [landingPageUrl] and [locationName].
namestringNoA 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_idintegerNoA 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_idintegerNoThe 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_idintegerNoA 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.

FieldTypeDescription
statusstringsuccess.
messagestringSMS Template has been updated successfully!
dataobjectThe saved template. For a shared template, this is your account's new copy.
data.idintegerThe template's id. Use it as sms_template_id.
data.namestringThe template's name.
data.contentstringThe message text, with merge fields in square brackets such as [customerName], [landingPageUrl] and [locationName].
data.landing_page_idinteger or nullThe landing page template linked to this text, or null.
data.review_site_idinteger or nullThe review site linked to this text, or null.
data.store_idinteger or nullThe 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."
    ]
  }
}
StatusMeaning
200The template was saved (for a shared template, as a new copy under your account).
400You edited a shared template and your account already has a template with that name.
401The token is missing, expired or invalid.
422A 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.
500Unexpected 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}'

Did this page help you?