ReceiveMessage command

This command can be used to receive an SMS message via the SMS Gateway using HTTP polling. HTTP polling means that you download SMS messages from the inbox folder of the gateway like you would download a webpage. In this section, you can get information about how you can use the ReceiveMessage method, what are the parameters, and you will be presented with an example HTTP request to download incoming messages.

Request parameters

Parameter name Example value Description Mandatory
Action receivemessage The HTTP API command yes
AfterDownload delete The way messages should be handled after a successful download. Messages can be deleted from the SMS gateway, they can be marked as downloaded and they can be left untouched. If they are left untouched, the next time you initiate a download request they will be downloaded again. no
Folder inbox The name of the folder. By default messages will be downloaded from the inbox folder. You can use the receivemessage method to download messages from other folders as well. no
Limit 10 The maximum number of messages to be downloded from the server within the request. You can download the remaining messages with subsequent requests. no
Username admin Specifies the username. The username and password parameters are used to authenticate the user. yes
Password abc123 Specifies the password. The username and password parameters are used to authenticate the user. yes
ResponseFormat html You can specify the format of the user's incoming messages. no

Response parameters

Parameter name Example value Description Mandatory
Code 200 Returns the status code of the response. yes
Message Command successfully executed Returns th description of the response code. yes
NotificationName CallConnected Name of the notification request type. no

Example request and response

URL request

http://127.0.0.1:9509/api?command=ReceiveMessage&action=receivemessage&Username=HTTP_User_1&Password=qwe123&Folder=inbox&Limit=2&AfterDownload=delete

Response

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE response PUBLIC "-//OZEKI//DTD XML 1.0//EN" "http://www.ozekisms.com/DTD/response.xml">
<response>
   <action>receivemessage</action>
   <data>
      <message>
         <messageid>ERFAV23D</messageid>
         <originator>06301234567</originator>
         <recipient>06201112222</recipient>
         <messagetype>SMS:TEXT</messagetype>
         <messagedata>Hello world</messagedata>
         <senttime>2008-01-16 10:04:00</senttime>
         <receivedtime>2008-01-18 20:58:04</receivedtime>
      </message>
      <message>
         <messageid>GYT4455D</messageid>
         <originator>06209994444</originator>
         <recipient>06201112222</recipient>
         <messagetype>SMS:TEXT</messagetype>
         <messagedata>Second message</messagedata>
         <senttime>2008-01-16 10:08:00</senttime>
         <receivedtime>2008-01-18 20:58:05</receivedtime>
      </message>
   </data>
</response>

More information