Receiving a Message

Receiving a Message

If you choose to purchase a shortcode or a long code then you will be sent messages from your consumers to the endpoint that you set up in MyMessageCloud. Take a look at the Getting Started With Gateway page if you need help with this step.

Variable Type Contents

action

String

The type of notification being sent to you. In the case of receiving a message, this field will always be mpush_ir_message.

id

String

A unique message ID, as assigned by MessageCloud. If you intend to reply to the message then you should store this value and send it to us in the id parameter during the Sending a Message process.

Please ensure that your HTTP receiver does not process the same message ID more than once. 

number

String

The telephone number of the consumer who has sent an SMS to your short or long code. This number will always be in the MSISDN format.

network

String

The originating network of the consumer. All mobile networks are assigned a unique network identification string by MessageCloud. As with the id parameter, this value must be used in the reply to us when attempting to send a premium SMS to the consumer.

message

String

The contents of the message that was sent by the consumer.

shortcode

Integer

The shortcode or long code that received the message from the consumer, if available.

country

String

The 2-digit country code from which the consumer originates, if available. For example, ES, IT, BR. See  http://www.iso.org/iso/country_codes/ for more information.

billing

String

The network billing type, if available. For example, MO, MT, DC.

There are also some optional parameters that can be received based on the application you are using:

Variable Type Contents

originating_network

String

The MCC and MNC (or IMSI) of the network from which the message originated.

originating_network_name

String

The name of the network from which the message originated.

originating_country

String

The two-digit country code (ISO 3166 alpha-2) of the country from which the message originated.

What happens when I don't accept a message?

MessageCloud offers a retry process for any messages that are not accepted by your endpoint. To be accepted, your server should reply with an HTTP 200 OK status along with an OK in the body of the response. If your server does not respond as expected then we will send automated emails to you informing you of the errors. This check can be switched on or off in the MyMessageCloud control panel.

When your server has not responded correctly we will attempt to redeliver the message according to the following timescale:

Attempt Sent After

2

30 seconds

3

30 minutes

4

1 hour

5

3 hours

After the 5th attempt, the message is dropped and will no longer be retried.

Example HTTP POST

The following is an example of how we will send an MO to your endpoint. We will be sending:
action=mpush_ir_message&message_id=1083545875&id=1083545875&billing=MT&country=UK&number=447445566731&network=THREE14UK&shortcode=68899&message=hello+world
To the endpoint:
https://receiver.example.com/test
* About to connect() to proxy proxy port 3128 (#178)
*   Trying 10.15.18.18...
* Connected to proxy (10.15.18.18) port 3128 (#178)
* Establish HTTP proxy tunnel to receiver.example.com:443
> CONNECT receiver.example.com:443 HTTP/1.1
Host: receiver.example.com:443
User-Agent: txtNation IR/mBill
Proxy-Connection: Keep-Alive

< HTTP/1.1 200 Connection established
< 
* Proxy replied OK to CONNECT request
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* 	subject: CN=*.example.com
* 	start date: May 08 00:00:00 2017 GMT
* 	expire date: Jun 07 23:59:59 2019 GMT
* 	common name: *.example.com
* 	issuer: CN=RapidSSL SHA256 CA,O=GeoTrust Inc.,C=US
> POST /test HTTP/1.1
User-Agent: txtNation IR/mBill
Host: receiver.example.com
Accept: */*
Content-Length: 166
Content-Type: application/x-www-form-urlencoded

* upload completely sent off: 166 out of 166 bytes
< HTTP/1.1 200 OK
< X-Served-By: Eos
< X-Send-Result: 1
< Content-type: text/html; charset=UTF-8
< Content-Length: 2
< Date: Mon, 06 Nov 2017 10:04:25 GMT
< Server: txtNation HTTP Server
< 
* Connection #178 to host proxy left intact

Next: Retrying Failed Messages