SIGN IN

Developers

Free Trial

messages.add


XML Request Example   XML Response Example   PHP Example   GET Example  

This method will create a new message.

Parameters:
  • list_id - list identifier required in one of the two following formats:
    • integer - the list id as a numeric value, this can be found by requesting 'contact-lists.get' and using corresponding id values from the dataset
      OR
    • string - the list name EXACTLY as it is in the 'contact-lists.get' response.
  • message - string - the sms body, can contain special system set variables such as [firstname], [lastname], [opt-out-info] etc.
  • caller_id - string - required in one of the two following formats:
    • numeric - up to 15 numeric characters (e.g. your mobile number if you want replies to come straight to your phone).
    • string - maximum of 11 characters, a-z, 0-9 and _ are valid characters, no spaces.
  • sendTime - integer - Unix Timestamp in GMT for when to send the message. If not supplied the message is sent immediately
  • validity - integer - the maximum number of minutes to attempt sending the message (1-4320)




XML Request Example

<?xml version='1.0'?>
<request>
	<version>0.3</version>
	<key>API_KEY</key>
	<secret>API_SECRET</secret>
	<method>messages.add</method>
	<params>
		<list_id>1075</list_id>
		<message>my sms body</message>
		<caller_id>614xxxxxxx</caller_id>
		<optout />
		<sendtime />
	</params>
</request>




XML Response Example

<?xml version='1.0'?>
<xml>
	<method>messages.add</method>
	<total>1</total>
	<time>2009-12-11 01:41:47 GMT</time>
	<timestamp>1260495707 GMT</timestamp>
	<data>
		<result>queued</result>
		<message_id>28076</message_id>
		<list_id>1075</list_id>
		<message>my sms body</message>
		<cost>0.084</cost>
		<balance>1.72</balance>
		<charge_error>None</charge_error>
		<datetime_send>2009-12-10 14:41:46</datetime_send>
	</data>
</xml>




PHP Example

Download the PHP API Client

<?php

// change api key and secret to your own
$myAPIKey = "API_KEY";
$myAPISecret = "API_SECRET";

// include base class
require('APIclient.php');

// create new client object
$transmitsmsAPI = new transmitsmsAPI($myAPIKey, $myAPISecret);

// set parameters
$list_id = 1075;
$body = 'my sms body';
$caller_id = 'John';

// execute request
$methodResponse = $transmitsmsAPI->addMessage($list_id, $body, $caller_id);

// parse response into xml object
$xml = @simplexml_load_string($methodResponse);

echo ((string) $xml->data->result == 'queued') ? "Message was added" : "Message was not added: " . (string) $xml->data->result;

?>




GET Example

Using a URL based request system you can request this method by using the below URL - be sure to url encode all your variables!

http://burstsms.com/api-wrapper/messages.add?apikey=API_KEY&apisecret=API_SECRET&list_id=LIST_ID&message=MY_SMS_MESSAGE&caller_id=ME&optout=0&sendtime=1264638377