Textlocal Logo

API Documentation

Get API MMS Message History

This command will retrieve a history of MMS messages sent through the API.

Resource URL

https://api.txtlocal.com/get_mms_history_api/

Sample Request

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

	// Prepare data for POST request
	$data = array('apikey' => $apiKey);
 
	// Send the POST request with cURL
	$ch = curl_init('https://api.txtlocal.com/get_mms_history_api/');
	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');

	// Prepare data for POST request
	$data = 'apikey=' . $apiKey;
 
	// Send the GET request with cURL
	$ch = curl_init('https://api.txtlocal.com/get_mms_history_api/?' . $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');

    $min_time = strtotime('-1 month'); // Get sends from a month ago
    $max_time = time(); // Up to now
    $limit = 1000;
    $start = 0;
    $sortOrder = 'asc';

    $response = $Textlocal->getMMSMessageHistoryAPI($start, $limit, $min_time, $max_time, $sort_order);
    print_r($response);
?>

Parameters

There are no additional parameters for this command
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
min_time Unix timestamp format of the oldest message. If not provided defaults to 6 months ago as of today.
max_time Unix timestamp format of the newest message. If not provided defaults to current time.
sort_order Order in which to sort the response. Either asc or desc. If not provided defaults to desc.
start Used in conjunction with limit to return a set of messages starting at the position given (such as 24), up to and including the limit.
limit Limit result set returned to a specific number of records. If not provided defaults to 1000.

Sample Response

{
    "total": 1,
    "messages": [
        {
            "id": "76212",
            "date": "2019-07-30 08:19:51",
            "message": "This is your message",
            "message_sent": "This is your message",
            "filename": "image-logo.png",
            "howmany": "1",
            "sched": "",
            "origin": "TXTLCL",
            "number": 447123456789,
            "status": "?"
        }
    ],
    "status": "success"
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
    <total>1</total>
    <messages>
        <message>
            <id>76212</id>
            <date>2019-07-30 08:19:51</date>
            <message>This is your message</message>
            <message_sent>This is your message</message_sent>
            <filename>image-logo.png</filename>
            <howmany>1</howmany>
            <sched></sched>
            <origin>TXTLCL</origin>
            <number>447123456789</number>
            <status>?</status>
        </message>
    </messages>
    <status>success</status>
</response>

Errors

Error Codes
45 Invalid sort field.
46 Invalid limit value.
47 Invalid sort direction.
48 Invalid timestamp.
63 Invalid start specified.