SendSms command

The SendSms command is used for sending SMS messages to mobile phones. To send an SMS you need to connect to an SMS modem or an SMPP server. After you connect you need to set up a dial plan. You can use it to send out SMS based receipts. For example, a customer pays through an IVR and gets an SMS receipt. You can also use it to send out a new password for a client as a response to his IVR based request. Or if a client orders a product through IVR, he/she could get the payment details in SMS.

Request parameters

Parameter name Example value Description Mandatory
DelivaryReportURL http://yourapp.com/smsdelivered.php URL that will be requested with delivery details when delivery report arrives to this message. no
Message Hello world Message text to send. yes
Recipient +061554670 Destination number of the message. yes
Sender +061554669 Sender number of the message. no
Username admin Specifies the username. The username and password parameters are used to authenticate the user yes
Password abc123 Specifies the password of the user acoount. yes

Response parameters

Parameter name Example value Description Mandatory
Code 200 Returns the status code of the response. yes
Message Command successfully executed. Returns the description of the response code. yes
NotificationName CallConnected Name of the notification request type. no
SmsId 6b5c6978-0cd6-4a58-86fc-3d1b279b9201 The ID of the SMS. This parameter only appears if the SMS was successfully sent. yes

OzML example

The OzML script below shows the usage of the SendSms command. The Speak commands informs the user about the progress of the message sending. After the message has been sent, the Hangup will terminate the call.

<?xml version="1.0"?>
<Response>
    <Speak>An SMS will be sent to +062554670.</Speak>
    <SendSms Recipient="+062554670">Hello! How are you?</SendSms>
    <Speak>The SMS has been sent.</Speak>
    <Hangup></Hangup>
</Response>

Example request and response

URL request

http://127.0.0.1:9509/api?command=SendSms&Username=HTTP_User_1&Password=qwe123&Sender=%2b0615546669&Recipient=%2b0615546670&Message=Hello+world&DeliveryReportURL=http://yourapp.com/smsdelivered.php

Response

<?xml version="1.0"?>
<OzApi_CommandResult_SendSms xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Code>200</Code>
  <Message>Command successfully executed</Message>
  <SmsId>7d678b16-0e81-4a05-805b-851e4794495e</SmsId>
</OzApi_CommandResult_SencdSms>

More information