Textlocal Logo

API Documentation

Send MMS

A UK only service This command can be used to send multimedia messages to either individual numbers or entire contact groups.

Note: Currently you cannot set the sender name for an MMS message, the default 88600 will be used instead.

Resource URL

https://api.txtlocal.com/send_mms/

Sample Request

<?php
	// Account details
	$apiKey = urlencode('Your apiKey');

	// Message details
        $numbers = 447123456789 .",". 447987654321;
	$sender = 'YourNumber';
	$message = 'This is your message';
	$url = 'https://api.txtlocal.com/image-logo.png';

	// Prepare data for POST request
	$data = array('apikey' => $apiKey, 'numbers' => $numbers, 'message' => $message, 'url' => $url);

	// Send the POST request with cURL
	$ch = curl_init('https://api.txtlocal.com/send_mms/');
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch);

	// Process your response here
	echo $response;
?>
<?php
	// Account details
	$apiKey = urlencode('Your apiKey');

	// Message details
	$numbers = urlencode('447123456789,447987654321');
	$sender = urlencode('YourNumber');
	$message = urlencode('This is your message');
	$url = urlencode('http://5449c16abdf00233679f-231bc887ba818731c2a5e9fd3d771de7.r11.cf3.rackcdn.com/company-logo.png');

	// Prepare data for POST request
	$data = 'apikey=' . $apiKey . '&numbers=' . $numbers . "&sender=" . $sender . "&message=" . $message . '&url=' . $url;

	// Send the GET request with cURL
	$ch = curl_init('https://api.txtlocal.com/send_mms/?' . $data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	$response = curl_exec($ch);
	curl_close($ch);

	// Process your response here
	echo $response;
?>
<?php
	require('Textlocal.class.php');
	
	$Textlocal = new Textlocal(false, false, 'your apiKey');
	
	// The MMS file can either be a fully-formed local path C:\path\to\your\file.jpg or a valid URL http://yourdomain.com/file.jpg
	$url = dirname(__FILE__) . '/mms-file.jpg';
	
	$numbers = array('447123456789');
	$message = 'This is an MMS message';

	$response = $Textlocal->sendMms($numbers, $url, $message);
	print_r($response);
?>

Caution: Some users opt to place their request inside a code loop, while testing we highly reccomend setting the test parameter to true, as occasionally an infinite loop can occur and users can consume all their credits very quickly.

Parameters

message The message content. Unlike SMS, there is no maximum length an MMS message can be in characters, as long as it does not push the message size (including the multimedia attachement) over 300KB.
numbers Comma-delimited list of mobile numbers in international format (i.e. 447123456789).
Login Parameters (Additional Information)
apiKey You can create these in your Messenger Control Panel (click here) for each application, and limit the usage of them by host IP Address.
Optional Parameters
sender MMS sender names must be numeric, we recommend using a mobile number, such as one of our inbound numbers. Alternatively you could set this to xreplyx, so replies would come into your simple reply service inbox. If a sender is not provided 44700000000 will be used as a default.
group_id This parameter can be used in place of the numbers parameter in order to send to an entire contact group. This parameter should contain the ID of the relevant group, which can found either within Messenger (in the "Reports" - "Advanced Reports" - "List of Group ID's" section) or by running the get_groups command.
url With this field you should specify a full URL to the media file you’d like to include with your message. Files must be below 300KB in size and a supported MIME type (see note below).
encodedimage Can be used instead of url. A Base-64 encoded JPEG image, max 300KB. Image will be auto resized if it exceeds this limit.
schedule_time This parameter can be used to specify a schedule date/time for your message, which should be provided in Unix timestamp format. Times should be provided in GMT.
optouts Can be set to true in order to check against your own opt-outs list and Textlocal's global opt-outs database. Your message will not be sent to numbers within these lists. If not provided defaults to false.
test Set this field to true to enable test mode, no messages will be sent and your credit balance will be unaffected. If not provided defaults to false

Supported MIME Types: image/jpeg, image/gif, image/x-png, image/png, image/vnd.wap.wbmp, image/x-bmp, audio/amr, audio/x-amr, audio/x-wav, audio/midi, audio/mid, audio/x-midi, audio/sp-midi, audio/rmf, audio/x-rmf, audio/x-beatnik-rmf, audio/basic, audio/mp3, video/3gpp, video/mp4, application/mp4, image/mp4, text/mp4, audio/mp4

Sample Response

{
	"balance":285,
	"batch_id":12345,
	"cost":2,
	"num_messages":2,
	"message":{
		"content":"This is your message",
		"filename":"image-logo.png"
	},
	"messages":[{
		"id":"294311",
		"recipient":447123456789
	},
	{
		"id":"294311",
		"recipient":447987654321
	}
	}],
	"status":"success"
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
	<balance>285</balance>
	<batch_id>12345</batch_id>
	<cost>2</cost>
	<num_messages>2</num_messages>
	<message>
		<content>This is your message</content>
		<filename>company-logo.png</filename>
	</message>
	<messages>
		<message>
			<id>294312</id>
			<recipient>447123456789</recipient>
		</message>
		<message>
			<id>294312</id>
			<recipient>447987654321</recipient>
		</message>
	</messages>
	<status>success</status>
</response>

Errors

Error Codes
4 No recipients specified.
5 No message content.
6 Message too long.
7 Insufficient credits.
8 Invalid schedule date.
9 Schedule date is in the past.
10 Invalid group ID.
11 Selected group is empty.
19 Invalid URL specified.
20 File is too big.
21 Invalid file type.
22 File not found (404).
23 Transfer failed.
29 Failed to process file. Please contact support.
30 No media file provided.
32 Invalid number format.
33 You have supplied too many numbers.
34 You have supplied both a group ID and a set of numbers.
43 Invalid sender name.
44 No sender name specified.
51 No valid numbers specified.

Warnings

Warning Codes
3 Invalid number.