Array of recipients’ phone numbers with settings and merge fields are passed, but information (also array) about how many phone numbers have been added to a specific list is returned.

listBatchSubscribeSMS(string $id, array $batch, boolean $update_existing) : struct
Input parameters
  • id - list ID
  • batch - array of phone numbers. Each phone number is represented as an array where field names are taken from merge fields and their appropriate values are set. Important
    Merge field type where phone numbers will reside, must be set to SMS type.
    Phone numbers need to be prefixed with international country code.
  • update_existing - whether existing emails will be restored (true, false) (optional). Default value is false.

Information obtained

Array consisting of:

  • success_count - number of successfully added phone numbers
  • error_count - number of unsuccessfully added phone numbers
  • errors - array of error messages about each phone number. Each error message is represented as an array consisting of fields:
    • code - error code
    • message - error message
    • phone - phone number that raised error


 $my_phone, 'FNAME' => 'Joe');
$batch[] = array('SMS' => $boss_phone, 'FNAME' => 'Boss');
$update_existing = false;
$retval = $api->listBatchSubscribeSMS($id, $batch, $update_existing);
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load listBatchSubscribeSMS()!\n";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "success:" . $retval['success_count'] . "\n";
    echo "errors:" . $retval['error_count'] . "\n";
    foreach ($retval['errors'] as $val) {
        echo "\t*" . $val['phone'] . " failed\n";
        echo "\tcode:" . $val['code'] . "\n";
        echo "\tmsg :" . $val['message'] . "\n\n";

© 2010-2020 Mailigen. All rights reserved.