Start a new topic

SMS Gateway Hub API <PHP>

SMS Gateway Hub API

Last updated October 12, 2014. Created on October 12, 2014.
Edited by subhojit777Log in to edit this page.

Contents:

Programmatically send SMSAPI hooksHook called before sending SMSHook called after sending SMSAlter SMSProgrammatically send SMS
<?php
/**
 * Send SMS.
 *
 * @param string $numbers
 *   Single number or comma separated numbers.
 * @param string $message
 *   SMS message.
 * @param int $flash
 *   0 or 1 indicating whether this SMS should be sent as flash message.
 * @param int $transactional
 *   0 or 1 indicating whether this SMS should be sent as transactional message.
 * @param int $scheduled_time
 *   Timestamp indicating when the message will be sent. If 0 then scheduled
 *   time is disabled.
 *
 * @return string
 *   Unique message id or failed response.
 */
smsgatewayhub_send_sms($numbers, $message, $flash = 0, $transactional = 0, $scheduled_time = 0);
?>

API hooksHook called before sending SMS

<?php
/**
 * Do something before sending SMS.
 *
 * This hook is invoked after hook_smsgatewayhub_sms_alter().
 *
 * @param string $numbers
 *   Single number or comma separated numbers.
 * @param string $message
 *   SMS message.
 * @param int $flash
 *   0 or 1 indicating whether this SMS should be sent as flash message.
 * @param int $transactional
 *   0 or 1 indicating whether this SMS should be sent as transactional message.
 * @param int $scheduled_time
 *   Timestamp indicating when the message will be sent. If 0 then scheduled
 *   time is disabled.
 */
function hook_smsgatewayhub_before_send_sms($numbers, $message, $flash, $transactional, $scheduled_time) {  // Do something here.}
?>

Hook called after sending SMS

<?php
/**
 * Do something after SMS is sent.
 *
 * @param string $numbers
 *   Single number or comma separated numbers.
 * @param string $message
 *   SMS message.
 * @param int $flash
 *   0 or 1 indicating whether this SMS should be sent as flash message.
 * @param int $transactional
 *   0 or 1 indicating whether this SMS should be sent as transactional message.
 * @param int $scheduled_time
 *   Timestamp indicating when the message will be sent. If 0 then scheduled
 *   time is disabled.
 * @param object $response
 *   Response object as returned by drupal_http_request().
 */
function hook_smsgatewayhub_after_send_sms($numbers, $message, $flash, $transactional, $scheduled_time, $response) {  // Do something here.}
?>

Alter SMS

<?php
/**
 * Alter message or number here.
 *
 * This hook is invoked before hook_smsgatewayhub_before_send_sms().
 * You can perform alter operations in this hook.
 *
 * @param array $data
 *   Array with alterable data. Attributes of data are:
 *   - numbers: A string containing numbers, single or multiple separated with
 *     comma.
 *   - message: SMS message.
 *   - flash: Indicating whether this SMS to be sent as flash message.
 *   - transactional: Indicating whether this SMS to be sent as transactional
 *     SMS.
 *   - scheduled_time: Timestamp indicating when the message will be sent.
 */
function hook_smsgatewayhub_sms_alter(&$data) {  // Do something here, like changing message text.}
?>

Login or Signup to post a comment