Send an MMS Message
Overview
Easily send an MMS message with some media content.
Authentication
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/account
Method
Send an MMS message.
POST
https://mmsc.tsgglobal.world/mms
The MMS API attempts to mirror an MM4 request, as such it shares some structural similarities and naming. Particularly the use of the ‘type’ field to denote the type of request. Currently only Forward Requests are available.
Request Body
id
string
An id, this id may be used to track the message. Note: this can be considered a reference_id.
type*
string
What type of data should we expect with this message. Should always be "mms-forward-req"
Note: failure to provide this value will cause the request to fail immediately.
expires_at
datetime
An ISO8601 formatted timestamp, this designates when the message should expire within the system, expired messages will be refunded if they expire before leaving the queues.
expires_in
integer
A duration in seconds after the message has been received to expire, this will be added to the time of receving the message to create an expires_at
value.
transaction_id
string
This field will be used as the transaction-id of the message, if none is provided, one will be generated.
from*
string
The originator number, should be formatted as E164.
to*
list<string>
A list of recipients, each number should be formatted as E164.
subject
string
An optional subject header to apply to the message.
headers
map
An optional map of additional headers to include in the message.
metadata
map
Any additional data to include in the payload, will be returned on response.
parts*
list
A list of parts that make up the body of the message.
kind
string
What kind of content does the part contain?, default “plain”.
headers
map<string, string>
Any additional headers to include in the part.
content_type
string
What is the media type of the part?, if none is given this will default to text/plain, unless the kind is a uri or data-uri.
content_location
string
The name of the attachment, in case a custom SMIL is provided, this will allow referencing the part.
content_encoding
string
Any special encodings applied to the body of the part, usually a compression method.
transfer_encoding
string
Any special encodings applied to the body of the part, normally for transport over HTTP/S.
body*
string
The body or content of the part, may or not be encoded as required.
uri
string
A URI that is publically accessible that can be downloaded to get the content of the MMS. Content exceeding 3mb will be rejected.
request_delivery_reports
boolean
Requesting DLR for the message to be sent to you. Defaults to false
Example POST
Delivery Receipts (DLRs)
DLRs for MMS messages are customer-enabled by optionally flagging a request for a DLR when POSTing to the API. Please include “request_delivery_reports”: true as in the above example, requesting that a DLR be sent to you. Omitting or setting it to false will result in no DLRs being forwarded to you.
Part Kinds
plain
Plain parts are used for text attachments, these include text/*
media types that do not include any binary or restricted characters (i.e. nulls).
data-uri
RFC2397 data URIs may be used to specify content_encoding, content_type and body in a single string. These strings however have a 65535 character limit.
uri
Parts can also be provided as URIs, the content_type will be taken from the request or determined based on the extension of the link.
Content downloaded from a URI must be 3 MB or less, otherwise it will be rejected and the message will have a nulled attachment.
The requested resource MUST return a valid Content-Length
, failure to do so will result in the attachment being nullified. NOTE: The server MUST respond to HEAD and GET requests for the attachment to be retrieved.
embedded
Parts MAY be embedded, in which all the data is included but MAY be compressed or encoded in a different format for transfer. Data in an embedded body must NOT exceed 1Mb (when compressed)
The body of the part will be decoded by applying:
transfer_encoding
content_encoding
To encode the part, apply the encodings in the reverse.
Note: All headers are subject to filter and may be excluded.
Any headers that start with following will not be added to the message:
x-mms-
content-
checksum-
x-checksum-
message-id
Example 200 OK Response
data.attributes.messages
will contain a message for each recipient. The provided message_id
will be used to reference the message in DLRs.
Additional Examples
Example - Escape Special Characters
Example - New Lines in Body
Example - the UTF-8 character - for more information please refer to RFC8259
Example - JSON Unicode escape
Frequently Asked Questions
Q - What is the maximum plain body text limit for an MMS message A - We recommend using 1000 characters or less.
Q - How many participants can I have in an MMS conversation A - We recommend having 10 or fewer participants in an MMS conversation.
Q - My request failed with a 400 Bad Request and a message saying unexpected character at X A - The JSON payload was malformed, did you include any new lines inside strings?
Q - How can I send a Line-feed/Carriage-return/other-non-printable-characters? A - JSON supports several escape sequences for handling non-printable-characters (see above).
Q - Can I send UTF-8 characters? A - Yes you can, the API supports UTF-8 encoding.
Q - Can I send an emoji? A - Yes you can, either using the unicode escape sequence or the UTF-8 character.
Last updated