Documentation

For developers who are looking to integrate SMSTech with an existing system, our comprehensive documentation provides all the information required to get you up and running.

Keywords

remove-list

Delete a list and its members.

PARAMETER DESCRIPTION REQUIRED
list_id List ID YES

Example

get inactive list members

curl https://api.transmitsms.com/remove-list.json \
-u 2e24c1cbdd987221e165d543f34b84bf:secret \
-d list_id=30

JSON RESPONSE

{
error: {
code: "SUCCESS",
description: "OK"
}
}

XML RESPONSE

<?xmlversion="1.0"encoding="UTF-8"?> <response> <error> <code>SUCCESS</code> <description>OK</description> </error> </response>

PHP Example

<?php include'../../APIClient2.php'; $api=new transmitsmsAPI("API_KEY",'API_SECRET'); $result=$api->removeList(6191); echo"Error: {$result->error->description}".PHP_EOL;

get-list

Get information about a list and its members.

PARAMETER DESCRIPTION REQUIRED
list_id List ID YES
members Which types of members to return.
Possible values:
active – only get active members (default)
inactive – only get inactive members
all – get active and inactive members
none – do not get any members, just metadata
NO
page Page number, for pagination NO
max Maximum results returned per page NO

Example

get inactive list members

curl https://api.transmitsms.com/get-list.json \
-u 2e24c1cbdd987221e165d543f34b84bf:secret \
-d list_id=30 \
-d members=inactive

Possible values of the members.status field are currently: active, deleted and opt-out.

JSON RESPONSE

{
page: {
count: 26,
number: 1
},
id: 34565667,
name: "Survey Respondents",
created: "2012-12-30 08:56:43",
members_total: 2544,
members_active: 2306,
fields: {
field_1: "Birthday",
field_2: "Town"
},
members: [
{
first_name: "Charles",
last_name: "Gordon",
msisdn: "61491570156",
created_at: "2013-05-23 01:22:12",
status: "deleted"
},
{
first_name: "Alex",
last_name: "Fergle",
msisdn: "61491570157",
created_at: "2013-01-23 05:22:12",
status: "active"
}
]
}

XML RESPONSE

<?xmlversion="1.0"encoding="UTF-8"?> <response> <page> <count>26</count> <number>1</number> </page> <id>34565667</id> <name>Survey Respondents</name> <created>2012-12-30 08:56:43</created> <members_total>2544</members_total> <members_active>2306</members_active> <fields> <field_1>Birthday</field_1> <field_2>Town</field_2> </fields> <members> <first_name>Charles</first_name> <last_name>Gordon</last_name> <msisdn>61491570156</msisdn> <created_at>2013-05-23 01:22:12</created_at> <status>deleted</status> </members> <members> <first_name>Alex</first_name> <last_name>Fergle</last_name> <msisdn>61491570157</msisdn> <created_at>2013-01-23 05:22:12</created_at> <status>active</status> </members> </response>

PHP Example

<?php include'../../APIClient2.php'; $api=new transmitsmsAPI("API_KEY",'API_SECRET'); $offset=0; $limit=10; $result=$api->getList(6191,$offset,$limit); if($result->error->code=='SUCCESS') { echo"List has {$result->members_total} members, showing page {$result->page->number} of {$result->page->count} <hr>"; foreach($result->membersas$member){ echo"{$member->first_name}{$member->last_name} - {$member->status} <br>"; } } else { echo"Error: {$result->error->description}"; }

add-list

Create a new list including the ability to add custom fields.

PARAMETER DESCRIPTION REQUIRED
name A unique name for the list YES
field_n A custom field name where n is an integer between 1 and 10. Once field names have been set they cannot be changed. NO

Example

curl https://api.transmitsms.com/add-list.json \
-u 2e24c1cbdd987221e165d543f34b84bf:secret \
-d name=Friends \
-d field_1=Birthday \
-d field_2=Town

JSON RESPONSE

{
id: 34565988,
name: "Special Offer Club",
created: "2013-07-20 07:36:23",
fields: {
field_1: "birthday",
field_2: "top score"
}
}

XML RESPONSE

<?xmlversion="1.0"encoding="UTF-8"?> <response> <id>34565988</id> <name>Special Offer Club</name> <created>2013-07-20 07:36:23</created> <fields> <field_1>birthday</field_1> <field_2>top score</field_2> </fields> </response>

PHP Example

<?php include'../../APIClient2.php'; $api=new transmitsmsAPI("API_KEY",'API_SECRET'); $customFields=array('custom1','custom2'); $result=$api->addList('LIST NAME',$customFields); if($result->error->code=='SUCCESS') { echo"List Created with ID {$result->id}"; } else { echo"Error: {$result->error->description}"; }

add-to-list

Add a member to a list.

PARAMETER DESCRIPTION REQUIRED
list_id ID of the list to add to YES
msisdn Mobile number of the member YES
first_name First name of the member NO
last_name Last name of the member NO
field_n Custom field value where n is an integer between 1 and 10. You can also use the names of the custom fields you have chosen for your list, e.g. field.birthday. NO
countrycode Formats msisdn for the given countrycode NO

Example

curl https://api.transmitsms.com/add-to-list.json \
-u 2e24c1cbdd987221e165d543f34b84bf:secret \
-d list_id=1234567 \
-d msisdn=61491570158 \
-d 'first_name=Ayrton' \
-d 'last_name=Senna' \
-d 'field_1=1979-05-05' \
-d 'field_2=Sydney'

JSON RESPONSE

{
list_id: 24556,
msisdn: "61491570156",
first_name: "Ayrton",
last_name: "Senna",
fields: {
birthday: "1968-10-05",
top_score: "1000000"
}
}

XML RESPONSE

<?xmlversion="1.0"encoding="UTF-8"?> <response> <list_id>24556</list_id> <msisdn>61491570156</msisdn> <first_name>Ayrton</first_name> <last_name>Senna</last_name> <fields> <birthday>1968-10-05</birthday> <top_score>1000000</top_score> </fields> </response>

Error Codes

CODE HEADER DESCIPTION
BAD_MOBILE 400 The mobile provided is invalid
BAD_MOBILE_COUNTRY 400 The country of the mobile provided is unavailable
OPTOUT 400 The recipient provided was previously opted-out
DUPLICATE_DELETED 400 The recipient provided was previously deleted

PHP Example

<?php include'../../APIClient2.php'; $api=new transmitsmsAPI("API_KEY",'API_SECRET'); $customFields=array('custom1_value','custom2_value'); $result=$api->addToList(6195,'61400000000','firstname','lastname',$customFields); if($result->error->code=='SUCCESS') { echo"Member added"; } else { echo"Error: {$result->error->description}"; }

add-field-to-list

Update or add custom fields to a list

PARAMETER DESCRIPTION REQUIRED
list_id ID of the list to add to YES
field_n Custom field value where n is an integer between 1 and 10. You can also use the names of the custom fields you have chosen for your list, e.g. field.birthday. YES (at least 1)

Example

curl https://api.transmitsms.com/add-field-to-list.json \
-u 2e24c1cbdd987221e165d543f34b84bf:secret \
-d list_id=1234567 \
-d 'field_1=Sydney'

JSON RESPONSE

{
custom_1: "Sydney",
id: 1234567,
error: {
code: "SUCCESS",
description: "OK"
}
}

XML RESPONSE

<?xmlversion="1.0"encoding="UTF-8"?> <response> <custom_1>Sydney</custom_1> <id>1234567</id> <error> <code>SUCCESS</code> <description>OK</description> </error> </response>

Error Codes

CODE HEADER DESCIPTION
KEY_NO_EXISTS 400 List with such id is not existing
MISSING_PARAM 400 Field param is missing (eg. field_n)

PHP Example

<?php include'../../APIClient2.php'; $api=new transmitsmsAPI("API_KEY",'API_SECRET'); $customFields=array('custom1_value','custom2_value'); $result=$api->addFieldToList(6195,$customFields); if($result->error->code=='SUCCESS') { echo "Custom field(s) added"; } else { echo "Error: {$result->error->description}"; }

delete-from-list

Remove a member from one list or all lists.

PARAMETER DESCRIPTION REQUIRED
list_id ID of the list to remove from. If set to 0 (zero) the member will be removed from all lists. YES
msisdn Mobile number of the member YES

Example

remove a member from a list

curl https://api.transmitsms.com/delete-from-list.json \
-u 2e24c1cbdd987221e165d543f34b84bf:secret \
-d list_id=4117 \
-d msisdn=61491570156

Example

remove a member from all of your lists

curl https://api.transmitsms.com/delete-from-list.json \
-u 2e24c1cbdd987221e165d543f34b84bf:secret \
-d list_id=0 \
-d msisdn=61491570156

JSON RESPONSE

{
list_ids: [
34544,
56788
]
}

XML RESPONSE

<?xmlversion="1.0"encoding="UTF-8"?> <response> <list_ids>34544</list_ids> <list_ids>56788</list_ids> </response>

PHP Example

<?php include'../../APIClient2.php'; $api=new transmitsmsAPI("API_KEY",'API_SECRET'); // this will delete member from all lists that belong to you // $result=$api->deleteFromList(6195, '61400000000'); // this will delete member from provided list $result=$api->deleteFromList(6195,'61400000000'); if($result->error->code=='SUCCESS') { echo"Member deleted from lists: ".implode(', ',$result->list_ids); } else { echo"Error: {$result->error->description}"; }

optout-list-member

Opt a user out of one list or all lists.

PARAMETER DESCRIPTION REQUIRED
list_id ID of the list to opt the user out of. Set this to 0 (zero) to opt out of all of your lists. YES
msisdn Mobile number of the member to opt out YES

Example

curl https://api.transmitsms.com/optout-list-member.json \
-u 2e24c1cbdd987221e165d543f34b84bf:secret \
-d 'list_id=1234567,556677' \
-d msisdn=61491570158 \

JSON RESPONSE

{
list_ids: [
83454,
9762
]
}

XML RESPONSE

<?xmlversion="1.0"encoding="UTF-8"?> <response> <list_ids>83454</list_ids> <list_ids>9762</list_ids> </response>

PHP Example

<?xml version="1.0" encoding="UTF-8"?> <response> <list_ids>83454</list_ids> <list_ids>9762</list_ids> </response><?php include'../../APIClient2.php'; $api=new transmitsmsAPI("API_KEY",'API_SECRET'); // Opt out of specific lists $result=$api->optoutListMember('1223,5667','6140000000'); // Opt out of all lists $result=$api->optoutListMember(0,'6140000000'); if($result->error->code=='SUCCESS') { echo"Message to {$result->recipients} recipients sent with ID {$result->message_id}, cost {$result->cost}"; } else { echo"Error: {$result->error->description}"; }

edit-list-member

Edit a member of a list.

PARAMETER DESCRIPTION REQUIRED
list_id ID of the list the member belongs to YES
msisdn Mobile number of the member to edit YES
first_name First name of the member NO
last_name Last name of the member NO
field.n Custom field value where n is an integer between 1 and 10. You can also use the names of the custom fields you have chosen for your list, e.g. field.birthday. To remove a value set it to an empty string. NO

Example

curl https://api.transmitsms.com/edit-list-member.json \
-u 2e24c1cbdd987221e165d543f34b84bf:secret \
-d 'list_id=1234567,556677' \
-d msisdn=61491570158 \
-d 'first_name=Ayrton' \
-d 'last_name=Senna' \
-d 'field.top_score=1000001'

JSON RESPONSE


XML RESPONSE

<?xmlversion="1.0"encoding="UTF-8"?> <response> <list_id>24556</list_id> <msisdn>61491570156</msisdn> <first_name>Paul</first_name> <last_name>Senna</last_name> <fields> <birthday>1968-10-05</birthday> <top_score>1000001</top_score> </fields> </response>

Error Codes

CODE HEADER DESCIPTION
BAD_MOBILE 400 The mobile provided is invalid
BAD_MOBILE_COUNTRY 400 The country of the mobile provided is unavailable
OPTOUT 400 The recipient provided was previously opted-out
DUPLICATE_DELETED 400 The recipient provided was previously deleted

PHP Example

<?php include'../../APIClient2.php'; $api=new transmitsmsAPI("API_KEY",'API_SECRET'); $customFields=array("2"=>'new custom field'); //please note - to leave current value intact - //pass null or no key in custom fields array //to delete value - pass empty string //in following example we leave first name and //first custom value intact and change last name and second custom value $result=$api->editListMember(6195,'61400000000',null,'new lastname',$customFields); if($result->error->code=='SUCCESS') { echo"Member change saved"; } else { echo"Error: {$result->error->description}"; }