Add a member to a list.


Parameter

Description

Required

list_idID of the list to add toYES
msisdnMobile number of the memberYES
first_nameFirst name of the memberNO
last_nameLast name of the memberNO
field_nCustom 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
countrycodeFormats msisdn for the given countrycodeNO


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>


Code

Header

Description

BAD_MOBILE400The mobile provided is invalid
BAD_MOBILE_COUNTRY400The country of the mobile provided is unavailable
OPTOUT400The recipient provided was previously opted-out
DUPLICATE_DELETED400The recipient provided was previously deleted


PHP Examples


<?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}";
  }