Skip to content

SMS Service

Md. Mazharul islam Mithu edited this page May 4, 2017 · 2 revisions

1. Send SMS

client = CheckMobi::Resources::SMS::Send.new(
           to: 'phone_number',
           text: 'Hello there!!',
           notification_callback: 'http://some_valid_url',
           platform: 'android' # => default is 'web'. allowed values: ios, android, web, desktop
         )

response = client.perform
details = JSON.parse(response.response_body)

if everything is ok,

{
    "id":"MSG-ED26AC71-807B-49B1-A81E-3956224A0CDC",
    "number_info":
    {
        "country_code":40,
        "country_iso_code":"RO",
        "carrier":"Orange",
        "is_mobile":true,
        "e164_format":"+40XXXXXXXXX",
        "formatting":"+40 XXX XXX XXX"
    }
}

For more info https://checkmobi.com/documentation.html#/send-sms

2. Get SMS details

client = CheckMobi::Resources::SMS::Details.new(id: 'id')
response = client.perform
details = JSON.parse(response.response_body)

if everything is ok,

{
    "request_date": 1433451511,
    "to": "+XXXXXXXXX",
    "description": "MX - Orange",
    "status": "sent",
    "charged_amount": 0.12,
    "charged_rate": 0.12,
    "units": 1
}

For more info https://checkmobi.com/documentation.html#/sms-details

Clone this wiki locally