Retrieve details of SMS asset

Overview

The get-sms Ortto endpoint of the assets entity is used to retrieve the content and details of an SMS asset.

This will return for an SMS asset:

  • The SMS body
  • The character count
  • The encoding used
  • The number of segments used
  • The mapped lnks

This page provides descriptions of this endpoint’s:


HTTP method and request resource

POST https://api.ap3api.com/v1/assets/get-sms

NOTE: Ortto customers who have their instance region set to Australia or Europe will need to use specific service endpoints relative to the region:

For example: https://api.eu.ap3api.com/v1/<entity/endpoint>

All other Ortto users will use the default service endpoint (https://api.ap3api.com/).


Path and query parameters

This endpoint takes no additional path and/or query parameters.


Headers

This endpoint requires a custom API key and content type (application/json for the request body) in the header of the request:

  • X-Api-Key: CUSTOM-PRIVATE-API-KEY
  • Content-Type: application/json

Request body

The request body consists of a JSON object whose valid elements are listed in the table below.

Example get SMS asset request body from Ortto's CDP

json

{ "asset_id": "63f3f1d0ae7e17e725033fe3" }

Valid request body elements

The following table lists all valid, optional request body elements that are available at this endpoint.

Element

Type

Description

asset_id

string

A string identifying the asset ID by their unique ID number.

contact_id

string

(optional) Provide the ID of a contact to populate the merge tags in the SMS body using this contact. By default this will fetch a random contact.

show_fallbacks

bool

(optional) Set to true to have the merge tag fallbacks provided in the body. Default: false

raw

bool

(optional) Set to true to include the full, raw liquid text for the merge tags in the body. Default: false

use_published

bool

(optional) Set to true to return the body of the published version of the asset, or set to false to return the latest draft version.


NOTE: In order to use a contact_id to control the personalisation used, you must not set the show_fallbacks or raw fields to true. (Simply omit, or set to false)


Response payload

The following JSON object is an example of an assets SMS call that Ortto retrieves from your Ortto account’s CDP after a request to this endpoint.

NOTE: The response may vary based on the structure of your SMS asset.

json

{ "encoding": "usc2", "chars_count": 206, "segments": 4, "body": "Hi Maxine, welcome to Ortto, find us here https://or.tto.com/wnfskFJs\nOpt out: https://or.tto.com/fdDFSkjdf-w", "mapped_links": { "https://or.tto.com/wnfskFJs": "https://ortto.com" } }

Response payload elements

The following table lists all elements (arrays, objects, or fields) in the response from a request to this endpoint.

Element

Type

Description

encoding

string

The type of encoding for this SMS, which is determined by what symbols are included in the SMS, and determines how many characters are taken up by each symbol.

chars_count

int

The number of characters taken up by this SMS

segments

int

The number of segments this SMS uses.

body

string

The content of the SMS asset, including all links.

mapped_links

array

If the SMS contains links (excluding the opt-out link), this details which URL the tracked links in the body point to.


How to find asset IDs

NOTE: Only assets created in the asset manager will contain an asset ID.

If you create an SMS campaign directly from the Campaigns navigation first, this will not include an asset ID to access.

To find the asset ID(s) for the asset_id element, follow these steps:

  1. Navigate to Marketing > Asset manager.
  2. Click on the asset you want to retrieve the ID for.
  3. Copy the asset ID from the URL.
Extracting the Asset ID of an SMS asset via the Asset Manager