MMS » Send

Sends a multimedia based message.


Base URL


All requests to TheTexting must be submitted to the base URL. TheTexting provides you with an option of a response as a JSON object, or an XML string - you get to choose which response by selecting the appropriate base URL for your request.


JSON end point

https://www.thetexting.com/rest/json

XML end point

https://www.thetexting.com/rest/xml

HTTP Methods

All requests are submitted through the HTTP POST using UTF-8 encoding and URL encoded values.

Expected "Content-Type" for POST is "application/x-www-form-urlencoded", however we also support "application/json", "application/jsonrequest", "application/x-javascript", "text/json", "text/javascript", "text/x-javascript", "text/x-json" when posting parameters as a JSON object.


Parameters

All requests require your API credentials (api_key & api_secret), which you can find under "API Settings" in TheTexting Dashboard.

Parameter Data Type Description
api_key String Required. Your API Key. Ex: api_key=2f0ihf5656lfu03jl
api_secret String Required. Your API Secret. Ex: api_secret=cluol3434qwfc0lg
from String Required (Paid) / Optional (Trial). For Paid Account: The MMS enabled number that has been purchased and associated to your account.
For Trial Account: Either skip this parameter, or use 'test' or 'sandbox' and your MMS will be sent using a shared number.
to String Required. Mobile number in international format, and one recipient per request. Ex: to=17327572923 when sending to CA (USA).
text String Optional (Required if 'mediaUrls' is empty). Body of the text message (with a maximum length of 1600 characters), UTF-8 and URL encoded value.
type String Optional. This can be omitted for text (default), but is required when sending a Unicode message (unicode) message.
mediaUrls String[] Required. Collection (array) of media URLs and limited to 10 URLs. Each image is limited to 600 KB max and the collective size of all images should not exceed 1000 KB. Supported file formats are : JPG, JPEG, GIF & PNG.

Sample (cURL)

            
            
                    curl --location --request POST 'https://www.thetexting.com/rest/json/mms/send' \
                    --header 'Content-Type: application/x-www-form-urlencoded' \
                    --data-urlencode 'api_key=your_api_Key' \
                    --data-urlencode 'api_secret=your_api_Key' \
                    --data-urlencode 'from=test' \
                    --data-urlencode 'to=1234567890' \
                    --data-urlencode 'mediaUrls=https://www.thetexting.com/images/ca.png'
                    --data-urlencode 'mediaUrls=https://www.thetexting.com/images/usa_flag.gif'
                
            
            

JSON Response (Success)

{
   "Response": {
      "message_id": "10011",
      "message_count": 1,
      "price": 0.020
   },
   "ErrorMessage": "",
   "Status": 0
}


XML Response (Success)

<TheTexting xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ErrorMessage/>
<Response>
<message_count>1</message_count>
<message_id>10012</message_id>
<price>0.020</price>
</Response>
<Status>0</Status>
</TheTexting>

JSON Response (Failure)

{
"Response": null,
"ErrorMessage": "Parameters Missing",
"Status": 2
}


XML Response (Failure)

<TheTexting xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ErrorMessage>Parameters Missing</ErrorMessage>
<Response i:nil="true"/>
<Status>2</Status>
</TheTexting>

Respond Codes

Code Meaning
0 Request is successful
1 Request has failed.
2 Parameters are missing.
3 Credentials are invalid.
4 Parameters are invalid.
5 Result has returned empty.
6 Status is invalid.
7 Destination not covered.
8 Invalid recipient number.
9 One or more provided media URLs are invalid.
10 One or more media URLs have exceeded the maximum allowed file size limit of 600 KB.
11 Collective file size of media resources have exceeded the maximum allowed file size limit of 1000 KB.
12 One or more media URLs have invalid path. Make sure to provide complete path of media URLs for e.g. https://www.thetexting.com/example.jpg
13 One or more media URLs are not a valid image. We only allow JPG, JPEG, PNG & GIF images.
14 The recipient country is not supported. MMS feature is currently supported in United States only.
15 The number of media resources received in request exceeded the maximum allowed limit. We currently only allow 10 images with collective file size of 1000 KB.
16 The source number provided does not support MMS based messages.
17 The message body has exceeded the maximum allowed limit of 1600 characters.

Callback Response

If you have set delivery callback URL in your profile, we will send you the following parameters.

Parameter Description
msgid TheTexting message ID for this message.
message-timestamp Date & Time when this message was sent.
status Status of the message. Either 'sent','delivered','rejected' or 'failed'.
cost Cost of the message.