Receive SMS with the Forward method

This method allows you to receive messages in real time by implementing a URL on your application server where new messages will be forwarded.

This tutorial will show you how to access messages sent by your customers. Before you proceed to implement this method, please read the introduction on how to receive incoming messages, where you can learn about numbers and the initial setup.

Pull method

This tutorial covers receiving new messages via the Forward method. Besides the Forward method, received messages can be accessed with the Pull method. Learn more in the Pull method documentation.

To receive incoming forwarded messages, you will have to set up a URL on your web server that can receive a POST request from our system.

Retry cycle and sender IP addresses

The received messages forward retry cycle and sender addresses are identical to that of Delivery Report forwarding on Notify URL, described in Delivery Reports on Notify URL.

Forward message example

When our system receives an MO message, it will be forwarded automatically to the URL you have provided during the Action setup. When a new message from your customers arrives in our system, it will be forwarded with the message body as follows:

{
  "results": [
    {
      "messageId": "817790313235066447",
      "from": "385916242493",
      "to": "385921004026",
      "text": "QUIZ Correct answer is Paris",
      "cleanText": "Correct answer is Paris",
      "keyword": "QUIZ",
      "receivedAt": "2016-10-06T09:28:39.220+0000",
      "smsCount": 1,
      "price": {
        "pricePerMessage": 0,
        "currency": "EUR"
      },
      "callbackData": "callbackData"
    }
  ],
  "messageCount": 1,
  "pendingMessageCount": 0
}	
  

Request body parameters

Parameter Type Description
results Messages Collection of reports, one per every received message.
messageCount Int Number of returned messages in this request.
pendingMessageCount Int Number of remaining new messages on our server ready to be returned in the next API call.

Messages

Parameter Type Description
messageId String The ID that uniquely identifies the received message.
from String Sender ID that can be alphanumeric or numeric.
to String The message destination address.
text String Full text of the received message.
cleanText String Text of received message without a keyword (if a keyword was sent).
keyword String Keyword extracted from the message text.
receivedAt Date Tells when Infobip platform received the message. It has the following format: yyyy-MM-dd'T'HH:mm:ss.SSSXXX.
smsCount Int The number of sent message segments.
pricePerMessage Decimal Cost of receiving a message.
currency String Currency of the message price.
callbackData int Custom callback data can be inserted during setup phase.