Developers

Use our Api to easily integrate and develop

Introduction

Spryng delivers a HTTP POST request to a script on your server whenever a mobile originated (MO) message arrives. You must set up a script that can handle HTTP POST data to receive the requests.

The HTTP request conducted by Spryng must be answered by your server in the response HTTP body with status code 200, which means that the message was successfully accepted by your system. If the HTTP server cannot be reached and if it returns e.g. 500 internal server error, Spryng assumes that the message was not successfully accepted by your system and the request will be retried once every minute. The message will not be retried forever, the current setting is 24 hours.

 

Receiving messages from Spryng

Example for a PHP script

class MOGateway
{
      $log = "MO RECEIVED. REQUEST: " .
              "Originator MSISDN: " .     $_POST['MSISDN'] .
              "First word (keyword) " .   $_POST['KEYWORD'] .
              "Message content: " .       $_POST['PARM'] .
              "Receiver's operator: " .   $_POST['OPERATOR'] .
              "Received at: " .           $_POST['TIMESTAMP'] .
              "Shortcode: " .             $_POST['SHORTCODE'] .
              "Country code: " .          $_POST['COUNTRY'];


      $db->query('UPDATE texts SET received = 1 WHERE msisdn = :msisdn;', array('msisdn' => $_POST['MSISDN']));

      echo 'TRUE';
  }
}

Parameters

Parameter
MSISDN  The phone number from which the response originated
KEYWORD  The keyword with which the message text starts
PARM  All message text after the KEYWORD
OPERATOR  Network Code of the MSISDN
TIMESTAMP  Time that message was received by SMSC or system
SHORTCODE  The shortcode to which the response was sent
COUNTRY  The three-letter country code (ISO 3166-1 alpha-3)

MSISDN

The phone number from which the response originated.

Type  MSISDN-numeric (international format without leading “00” or “+”)
Min length  1 MSISDN
Max length  1 MSISDN
Min value  <na>
Max value  <na>
Values  <na>
Default value  <none>
Example  MSISDN=44712345678

KEYWORD

The keyword with which the message text starts. Characters will be urlencoded.

Type  Alphanumeric
Min length  2
Max length  15
Min value  <na>
Max value  <na>
Values  <na>
Default value  <none>
Example  KEYWORD=WIN

PARM

All message text after the KEYWORD. Characters will be urlencoded.

Type  Alphanumeric
Min length  <na>
Max length  <na>
Min value  <na>
Max value  <na>
Values  <na>
Default value  <none>
Example  PARM=ON

OPERATOR

Network Code of the MSISDN. Network Codes for other countries can be found on the following website: http://www.mcc-mnc.com/.

Type  Numeric
Min length  5
Max length  5
Min value  <na>
Max value  <na>
Values  See appendix B
Default value  OPERATOR=23420
Example  MSISDN=44712345678

TIMESTAMP

Time that message was received by SMSC or, if not supplied; time when it hit our system. See Appendix A for Field Types.

Type  Time
Min length  14
Max length   14
Min value  <na>
Max value  <na>
Values  <na>
Default value  <none>
Example  TIMESTAMP=20040208152544

SHORTCODE

The shortcode to which the response was sent.

Type  Numeric (national format
Min length  <na>
Max length  <na>
Min value  <na>
Max value  <na>
Values  <na>
Default value  <none>
Example  SHORTCODE=4414

COUNTRY

The three-letter country code ISO 3166-1 alpha-3. A list of the current officially assigned ISO 3166-1 alpha-3 codes can be found at http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3.

Type  Alphanumeric (ISO 3166-1 alpha-3)
Min length  3
Max length  3
Min value  ABW
Max value  ZWE
Values  ISO 3166-1 alpha-3
Default value  <none>
Example  COUNTRY=GBR

Field Types

Type  Values
Numeric  characters 0 to 9
Alphanumeric  character from ISO-8859-1
MSISDN-numeric  characters 0 to 9, first character might be a ‘+’ sign
Time  time as YYYYMMDDHHMMSS

Network Codes

Below the current list of networkcodes as used in the OPERATOR parameter

Operator Network Code
Belgium
Proximus 20601
Mobistar 20610
Base 20620
France
Bouygues Telecom 20820
Orange 20801
SFR 20810
Germany
T-Mobile 26201
E-Plus 26203
Mobilcom 26213
O2 26207
Vodafone 26202
Spain
Orange 21403
Telefonica 21407
Vodafone 21401
The Netherlands
KPN Mobile 20408
Vodafone 20404
T-Mobile 20416
Telfort 20412
Orange 20420
Tele2 20402
Turkey
Avea 28604
Vodafone 28602
Turkcell 28601
United Kingdom
3 23420
O2 23410
Orange 23433
T-Mobile 23430
Vodafone 23415

Introduction

Spryng delivers a HTTP POST request to a script on your server whenever a mobile originated (MO) message arrives. You must set up a script that can handle HTTP POST data to receive the requests.

The HTTP request conducted by Spryng must be answered by your server in the response HTTP body with status code 200, which means that the message was successfully accepted by your system. If the HTTP server cannot be reached and if it returns e.g. 500 internal server error, Spryng assumes that the message was not successfully accepted by your system and the request will be retried once every minute. The message will not be retried forever, the current setting is 24 hours.

 

Receiving messages from Spryng

Example for a C# script

using SpryngApiMoGateway.Models;

namespace SpryngApiMoGateway.Controllers
{
    public class SpryngController : Controller
    {
        [HttpGet]
        [Route("api/spryng/mo-gateway-webhook")]
        public ActionResult Index(MoGatewayResponseModel model)
        {
            // ASP.Net doesn't properly serialize the timestamp. Serialize it manually.
            model.Timestamp = DateTime.ParseExact(Request.QueryString["TIMESTAMP"], "yyyyMMddHHmmss", CultureInfo.InvariantCulture);

            return Json(model, JsonRequestBehavior.AllowGet);
        }
    }
}

Parameters

Parameter
MSISDN  The phone number from which the response originated
KEYWORD  The keyword with which the message text starts
PARM  All message text after the KEYWORD
OPERATOR  Network Code of the MSISDN
TIMESTAMP  Time that message was received by SMSC or system
SHORTCODE  The shortcode to which the response was sent
COUNTRY  The three-letter country code (ISO 3166-1 alpha-3)

MSISDN

The phone number from which the response originated.

Type  MSISDN-numeric (international format without leading “00” or “+”)
Min length  1 MSISDN
Max length  1 MSISDN
Min value  <na>
Max value  <na>
Values  <na>
Default value  <none>
Example  MSISDN=44712345678

KEYWORD

The keyword with which the message text starts. Characters will be urlencoded.

Type  Alphanumeric
Min length  2
Max length  15
Min value  <na>
Max value  <na>
Values  <na>
Default value  <none>
Example  KEYWORD=WIN

PARM

All message text after the KEYWORD. Characters will be urlencoded.

Type  Alphanumeric
Min length  <na>
Max length  <na>
Min value  <na>
Max value  <na>
Values  <na>
Default value  <none>
Example  PARM=ON

OPERATOR

Network Code of the MSISDN. Network Codes for other countries can be found on the following website: http://www.mcc-mnc.com/.

Type  Numeric
Min length  5
Max length  5
Min value  <na>
Max value  <na>
Values  See appendix B
Default value  OPERATOR=23420
Example  MSISDN=44712345678

TIMESTAMP

Time that message was received by SMSC or, if not supplied; time when it hit our system. See Appendix A for Field Types.

Type  Time
Min length  14
Max length  14
Min value  <na>
Max value  <na>
Values  <na>
Default value  <none>
Example  TIMESTAMP=20040208152544

SHORTCODE

The shortcode to which the response was sent.

Type  Numeric (national format
Min length  <na>
Max length  <na>
Min value  <na>
Max value  <na>
Values  <na>
Default value  <none>
Example  SHORTCODE=4414

COUNTRY

The three-letter country code ISO 3166-1 alpha-3. A list of the current officially assigned ISO 3166-1 alpha-3 codes can be found at http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3.

Type  Alphanumeric (ISO 3166-1 alpha-3)
Min length  3
Max length  3
Min value  ABW
Max value  ZWE
Values  ISO 3166-1 alpha-3
Default value  <none>
Example  COUNTRY=GBR

Field Types

Type  Values
Numeric  characters 0 to 9
Alphanumeric  character from ISO-8859-1
MSISDN-numeric  characters 0 to 9, first character might be a ‘+’ sign
Time  time as YYYYMMDDHHMMSS

Network Codes

Below the current list of networkcodes as used in the OPERATOR parameter

Operator Network Code
Belgium
Proximus 20601
Mobistar 20610
Base 20620
France
Bouygues Telecom 20820
Orange 20801
SFR 20810
Germany
T-Mobile 26201
E-Plus 26203
Mobilcom 26213
O2 26207
Vodafone 26202
Spain
Orange 21403
Telefonica 21407
Vodafone 21401
The Netherlands
KPN Mobile 20408
Vodafone 20404
T-Mobile 20416
Telfort 20412
Orange 20420
Tele2 20402
Turkey
Avea 28604
Vodafone 28602
Turkcell 28601
United Kingdom
3 23420
O2 23410
Orange 23433
T-Mobile 23430
Vodafone 23415