Create MMS Template

Authentication

circle-info

Authentication is done by passing your TSG Global API key via the Authorization header in the format "Authorization: Bearer <api_key>" (using the messaging API key specifically). API credentials can be found here: https://customer-portal.tsgglobal.com/accountarrow-up-right

POST https://mmsc.tsgglobal.world/mms/templates

Creates a new MMS template, the template has placeholders so you can use it to fill per-customer information as needed.

Request body

Name
Type
Description

data.type

string

Must be "mms-template"

data.attributes.name

string

Required. Template name

data.attributes.body_template

string

Required. Body text with {placeholder} syntax

data.attributes.subject_template

string

Optional. Subject line with {placeholder} syntax

data.attributes.parts

array

Optional. List of attachment parts (see below)

data.attributes.parts[].kind

string

Required. One of "data-uri", "uri", "plain", "embedded"

data.attributes.parts[].content_location

string

Optional. Filename for the attachment

data.attributes.parts[].uri

string

Required for "uri" and "data-uri" kinds. The resource URI or RFC 2397 data URI

data.attributes.parts[].body

string

Required for "plain" kind

data.attributes.parts[].content_type

string

Optional. MIME type (default: "text/plain")

Placeholders use the pattern {key} where key matches [a-zA-Z_][a-zA-Z0-9_]*. Extracted placeholders are returned in the response.

Example with placeholders

Example of a request

Besides the text in body_template there's 2 parts: a Base64 encoded attachment (kind: "data-uri") and a image that's referenced by a URL ("kind": "uri").

Example response

Example without placeholders

This is an example with no placeholders (notice the lack of {placeholder} syntax.

Example of a request

This is an example without placeholders and a single image attachment provided via ("kind": "uri"). Note: the attachment has to be publicly accessible.

Example response

Last updated

Was this helpful?