smsCampaigns()

SMS campaign list is returned by request. When sending a request, it is possible to perform data selection due to which SMS campaigns will be returned from the database. Selection parameters are transferred, while SMS campaign list (array) is returned. If selection parameters are not transferred, information about all SMS campaigns is returned.

smsCampaigns(array $filters, integer $start, integer $limit) : array
Input parameters
  • filters - selection parameters (optional). Array consisting of any of following parameters:
    • campaign_id - SMS campaign ID (optional)
    • recipients - list ID (optional)
    • status - status of SMS campaign (sent, draft, sending) (optional)
    • sender - SMS sender name (optional)
    • title - name of SMS campaign (optional)
    • sendtime_start - sending time before (SMS campaigns sent before a specific date are selected) (optional)
    • sendtime_end - sending time after (SMS campaigns sent after a specific date are selected) (optional)
  • start - page number starting from which selection will be made (optional). Default value is 0.
  • limit - number of results returned in one page(optional). Default value is 25. Maximum allowable value is 1000.

Information obtained

Array of SMS campaigns. Each SMS campaign is represented as an array that includes:

  • id - SMS campaign ID used in other API functions
  • web_id - SMS campaign ID for web version (used for URL link from archive)
  • title - name of SMS campaign
  • create_time - date of creating SMS campaign
  • send_time - date of sending SMS campaign
  • sms_sent - number of sent SMS
  • status - status of SMS campaign (sent, draft, paused, sending)
  • sender - SMS sender name
  • analytics - whether Google Analytics tool is integrated (true, false)
  • analytcs_tag - name of Google Analytics campaign
  • track_clicks - whether clicks are counted (true, false)
  • unicode - whether to send out the SMS campaign using unicode text option is set (true, false)
  • concatenate - whether to send out multiple SMS messages option is set (true, false)

Examples

mgapi_smsCampaigns.php
smsCampaigns();
header("Content-Type: text/plain");
if ($api->errorCode){
    echo "Unable to load smsCampaigns()!";
    echo "\tCode=".$api->errorCode."\n";
    echo "\tMsg=".$api->errorMessage."\n";
} else {
    echo sizeof($retval)." SMS Campaigns Returned:\n";
    foreach($retval as $c){
        echo "Campaign Id: ".$c['id']." - ".$c['title']."\n";
        echo "\tStatus: ".$c['status']."\n";
        echo "\tsent: ".$c['send_time']." to ".$c['sms_sent']." members\n";
    }
}

© 2010-2017 Mailigen. All rights reserved.