Installation and initialization

  • Log in to SMS Scheduler website.
  • Go to the "Senders" page (Menu -> Senders) and add at least one sender.
  • Download the SDK file
  • Add the following code at the beginning of your script :

require_once $your_path.'/SmsScheduler.php';

$SmsScheduler = new SmsScheduler($email, $password);
$your_path (String - optional) : The path where you store SmsScheduler.php file.
$email (String - required) : The email you use to access SMS Scheduler website.
$password (String - required) : The password you use to access SMS Scheduler website.
$SmsScheduler (Object) : The object that need to be instatiated for all operations described below.

Create SMS (to one or multiple phone numbers)

REQUEST


$SmsScheduler->create_sms($message, $delivery_date, $sender, $phone_numbers);
// example : 
$SmsScheduler->create_sms(
    "My message", 
    1573250000, 
    "123456789123456", 
    array("+330101010101", "+330202020202", "+490303030303", "0404-040-404")
);
$message (String - required) : Content of your message.
$delivery_date (Int - required) : Timestamp for the date the message will be send to. If the date is equal or inferior to the current date, the SMS will be sent right away.
$sender (String - required) : The sender ID available on "Senders" page in SMS Scheduler when you are logged in.
$phone_numbers (Array or String - required) : The phone numbers you want to send the message to with the country prefix and without spaces or hyphens (ex : +33123456789). It can be a String for a single number or an Array for multiple numbers.

RESPONSE


array(
  "success": => array(
    "sms_id" => 123456,
    "phone_numbers" => array("+33601010101", "+33602020202", "+496303030303")
  ),
  "error" => "Invalid phone_number",
  "invalid_phone_number" => array("0404-040-404")
}
success (Array) : If present, the SMS with the phone numbers inside have been created and are ready for sending.
  • sms_id (Int) : Unique ID representing the message. You should store it in your database in order to delete or update the message or to check if the corresponding SMS have been successfully sent.
  • phone_numbers (Array) : All phone numbers the message will be send to.
error (String) : If present, describe the error that occur when trying to create one or multiple SMS.
invalid_phone_number (Array) : If present, describe the phone numbers that were not properly formatted. No SMS will be created and send for this numbers.

Delete SMS

REQUEST


$SmsScheduler->delete_sms($sms_id);
// example : 
$SmsScheduler->delete_sms(123456);
$sms_id (Int - required) : The unique ID you received when the message was created.

RESPONSE


// example if success :
array(
  "success" => array(
    "deleted" => 3
  )
)
// example if failed :
array(
  "error" => "Wrong or invalid sms_id"
)
success (Array) : If present, the SMS that correspond to the message unique ID have been deleted successfully.
  • deleted (Int) : Number of SMS deleted.
error (String) : Reason of the error (sms_id variable is wrong).

Get SMS report

REQUEST


$SmsScheduler->report_sms($sms_id);
// example : 
$SmsScheduler->report_sms(123456);
$sms_id (Int - required) : The unique ID you received when the message was created.

RESPONSE


// example if success :
array(
  "success" => array(
    "sms_id" => 123456,
    "report" => array(
      "Scheduled" => array(
        "+33601010101", 
        "+496303030303"
      ),
      "Cancelled -- Contact added to blacklist" => array(
        "+33602020202"
      ),
      "Missed -- Invalid phone number" => array(
        "+33602022356"
      )
    )
  )
)

// example if failed :
array(
  "error" => "Wrong or invalid sms_id"
)

success (Array) : If present, a report is available.
  • sms_id (Int) : Unique ID representing the message
  • report (Array) : List all SMS corresponding to the unique message ID
    • phone_number (String) : The corresponding phone number.
    • status (String) : The status of the sending. Possible values are :
      • Scheduled
      • Pending
      • Sent
      • Received
      • Cancelled -- Missing contact or phone number
      • Cancelled -- Invalid phone number
      • Cancelled -- Missing text message
      • Cancelled -- Invalid text message
      • Cancelled -- Missing sender
      • Cancelled -- Invalid sender
      • Cancelled -- Not enough credits
      • Cancelled -- Blacklisted contact or phone number
      • Cancelled -- End of validity period
      • Cancelled -- Unavailable country
      • Cancelled -- Error
      • Missed -- Invalid phone number
      • Missed -- Blacklisted phone number or blocked by phone carrier
      • Missed -- End of validity period
      • Missed -- Network not available on sending phone
      • Missed -- Sending failed (Unknown reason)
      • Missed -- Error
error (String) : Reason of the error (sms_id variables is wrong).