New SMS campaign is created and array of parameters is passed including information about SMS campaign settings and SMS message content.

smsCampaignCreate(array $options, array $content) : string
Input parameters
  • options - SMS campaign settings. Array consisting of:
    • sender - SMS sender name. Specify a name from which the campaign will be received (see Registering SMS sender name)
    • recipients - options for specifying recipients. Array consisting of:
      • list_id - list ID
      • segment_id - segment ID (optional). User created segment based only on given list ID
      • merge - name of the SMS field. For example MERGE10, SMS
    • tracking - SMS campaign tracking (optional). Array of boolean values for following options:
      • clicks - click tracking (default value is true)
    • title - name of the campaign (optional)
    • analytics - web analytics integration option (optional). Array of options for given web analytics tool. 
      For example, to use Google Analytics, this option should look like: array( "google" => "YOUR_GOOGLE_ANALYTICS_KEY" ) "YOUR_GOOGLE_ANALYTICS_KEY" then will be added to all of the links found in your email. Statistics will be accessible in your Google Analytics account.
    • unicode - whether to send out the SMS campaign using unicode text (optional). If set to true, SMS will be sent with mitigation and longitude marks. This is useful for foreign languages and special characters. Default value is false.
    • concatenate - whether to send out multiple SMS messages if the text is too long (optional). Send SMS campaign up to 3 joint SMS. Default value is false.
  • content - campaign email content. Array consisting of:
    • text - SMS message OR
    • template_id - user defined SMS template ID to be used for generating SMS message
Information obtained
  • ID of the new SMS campaign


    'recipients' => array(
        'list_id' => $listId,
        //'segment_id' => $segmentId,
        'merge' => $smsMergeField,
    'tracking' => array(
        'clicks' => true
    'analytics' => array(
        'google' => 'my_google_analytics_key'
    'title' => 'Test SMS Title',
    'unicode' => true,
    'concatenate' => true
$content = array(
    'template_id' => 'template_id',
$content = array(
    'text' => 'some pretty content message',
$retval = $api->smsCampaignCreate($options, $content);
header("Content-Type: text/plain");
if ($api->errorCode){
    echo "Unable to load smsCampaignCreate()!\n";
    echo "\tCode=".$api->errorCode."\n";
    echo "\tMsg=".$api->errorMessage."\n";
} else {
    echo "New SMS Campaign ID:".$retval."\n";

© 2010-2020 Mailigen. All rights reserved.