Methods

Objects

RECEIVING SMS

Mobile Originated (MO)

Receive replies or inbound messages on reserved keywords and/or shortcodes.

Summary

    API init

    require 'vendor/autoload.php'; // Composer
    
    $api = new \CALLR\API\Client;
    $api->setAuth(new \CALLR\API\Authentication\LoginPasswordAuth('login', 'password'));
    
    var callr = require('callr');
    var api = new callr.api(callr.loginPasswordAuth('login', 'password'));
    
    require 'callr'
    api = CALLR::Api.new('login', 'password')
    
    import callr
    api = callr.Api("login", "password")
    
            

    Configure a Webhook - URL to receive replies

    Method

    Objects

    • Webhook
    $type = 'sms.mo';
    $endpoint = 'http://yourdomain.com/webhook_path';
    $options = null;
    
    $result = $api->call('webhooks.subscribe', [ $type, $endpoint, $options ]);
    
    var type = 'sms.mo';
    var endpoint = 'http://yourdomain.com/webhook_path';
    var options = null;
    
    api.call('webhooks.subscribe', type, endpoint, options).success(function(response) {
        // success callback
    });
    
    type = 'sms.mo'
    endpoint = 'http://yourdomain.com/webhook_path'
    options = nil
    
    result = api.call('webhooks.subscribe', type, endpoint, options)
    
    type = 'sms.mo'
    endpoint = 'http://yourdomain.com/webhook_path'
    options = None
    
    result = api.call('webhooks.subscribe', type, endpoint, options)
    
            

    Returns a Webhook object.


    You're all set! MO and replies will be sent to this Webhook.


    An example of the data pushed is available on the Webhooks page.

    Set MO URL per SMS sent - URL to receive replies


    To receive replies, you can use Webhooks. You can subscribe globally to the webhook sms.mo (see above). You can also use a "dynamic" webhook like below. MO will be sent to both the global Webhook and the dynamic Webhook. DLR of this MT will also be sent to this specific Webhook.


    When using a dynamic Webhook, you only need to set endpoint and optionally options.

    Do not set a sender if you want to receive replies - we will automatically use an SMS number.

    Method

    Objects

    • SMS.Options
    • Webhook
    $options = new stdClass;
    $options->webhook = new stdClass;
    $options->webhook->endpoint = 'http://yourdomain.com/webhook_path';
    
    $result = $api->call('sms.send', ['', '+16469820800', 'Hello, SMS world!', $options]);
    
    var optionSMS = {
        webhook: {
            endpoint: 'http://yourdomain.com/webhook_path'
        }
    };
    
    api.call('sms.send', '', '+16469820800', 'Hello world!', optionSMS).success(function(response) {
        // success callback
    });
    
    optionSMS = {
        :webhook => {
            :endpoint => 'http://yourdomain.com/webhook_path',
        }
    }
    
    result = api.call('sms.send', '', '+33612345678', 'Hello world!', optionSMS)
    
    optionSMS = {
        'webhook': {
            'endpoint': 'http://yourdomain.com/webhook_path',
        }
    }
    
    result = api.call('sms.send', '', '+16469820800', 'Hello world!', optionSMS)