Front SMS Gateway API (Product description)
Front offers SMS Gateway with http-based interface. By sending HTTP-based commands, the customer can send and receive messages via the Front’s message service / gateway to an end user’s mobile or an application.
1 Account
1.1 Users
When ordering, you will receive an invitation to an administrator user for the WEB interface. Once you have created this, you will be given the choice to invite more users. If you have your own developer or development team, you can invite them as "Administrator" so that they have access to setting up the SMS Gateway API and can set this up as desired. The portal is available in both Norwegian and English.
The Norwegian version of the product description is available here: gw-produktbeskrivelse.
1.2 Setup – SMS Gateway API
Authentication
Under the API settings, you will find examples of JSON and HTTP GET requests.
There is also information about the user identification to be used (Service ID).
You can choose whether you want to authenticate by IP address(es) or create a password.
URL for status and incoming
You can set up the desired URL for status messages. This is not mandatory but allows receiving feedback if messages are delivered to the recipient’s mobile phone, and possibly other status messages received from the carriers.
To support receiving SMS or replies, you must set up the URL where you wish to receive these.
Notifications for error messages
You can set up one or more email addresses for receiving error messages. We recommend this especially in the initial phase/development phase, as these messages provide useful information about the cause of the error (error codes).
There are separate notifications for errors while sending text messages and errors delivering received text messages to your server. For incoming notifications where we cannot deliver messages, the messages will be queued. The notifications will include a link to restart the queue once the problem is solved.
Security measures
NB: If the functionality to generate an SMS is on a publicly available, we recommend implementing security measures. Examples are solutions where you enter a mobile number to receive a one-time code or other information.
This is to prevent malicious robots from mass sending messages via your account.
We have customers who have been exposed to this with traffic to various countries. We therefore recommend setting up logic to limit the risk of such attacks that often come from geographical locations, with many requests from the same IP addresses, or unusually high traffic to countries you do not operate in. reCAPTCHA in combination with other measures (limitations) might be a solution to consider.
2 PARAMETER INDEX
2.1 OUTBOUND MESSAGES
Texts may be sent by either by performing a HTTP POST request with a JSON document containing the parameters below or a HTTP GET request to the SMS Gateway including the parameters in the query string.
| Parameter | Description | Accepted values | Comment |
|---|---|---|---|
| serviceid | Server identifier | Unique customer ID | Required |
| password | Gateway password | No restrictions | Not required when IP authentication is used |
| phoneno | Telephone number for the recipient. | International phone number with country code 004799999999 or +479999999 | Required |
| txt | The message being sent. | Text containing only characters in the GSM character set (GSM 03.38). Other characters are replaced. If the "unicode" parameter is supplied, all Unicode characters is accepted | Required. A message consists of 160 characters (Unicode: 70). If a message contains more, it counts as multiple SMS. Each SMS is then a length of 153 characters (Unicode: 67). Max is 1530 characters. |
| fromid | Unique Sender ID | An assigned number / serial number of Front or assigned sender text, maximum 11 characters. | Required – Unique number to receive a response or text. |
| price | Premium (charged) messages | Amount in Norwegian cents (øre) NOK 30=3000. Must be activated by Front | Optional. When a valuation is set, fromid must be "2401"; max 160 characters in the text. Can only be sent to Norwegian phone numbers. |
| unicode | Allow sending of Unicode texts | true, false | Optional. By default, all texts are sent using the GSM character set (GSM 03.38), and non-supported characters are converted. When “unicode” is true, all characters (emoji, etc.) are allowed, and no conversions are applied. The text will only be sent as Unicode if it contains characters not found in the GSM character set. |
| encoding | URL percent encoding character set | iso-8859-1, utf8, utf-8 | Optional. Default character set is latin1 (ISO-8859-1). Note: most modern HTTP libraries perform UTF-8 percent encoding by default. (This parameter is not used for JSON requests, as JSON is always encoded as UTF-8). |
| ref | Your ID or reference | text, max 100 characters or an integer | Optional. If ref is included in the request, the ref and phoneno will be included in the delivery status report |
| scheduled | Date and time to send the text | ISO 8601 datetime, e.g. 2024-01-30T14:40:00Z | Optional. Must be in the future Default value: immediate. UTC is assumed if no time zone is supplied. |
| validity | Validity period in minutes | positive integer | Optional. Default value: 1 week in minutes. Validity period is how long the carrier should attempt to deliver the text before failing when the recipient is not connected to the mobile network (phone turned off, no coverage, SIM card removed, etc.). The carrier’s maximal validity period is used when it is shorter than the supplied value. |
| flash | Flash message | true, false | Optional. Default value: false. Attempt to send the text as Flash SMS that is displayed directly on the main screen without user interaction. Not supported by all carriers. |
| protocolid | GSM Protocol Identifier (TP-PID) | 0 – 255 | Optional. Default value: 0. Attempt to send with GSM Protocol Identifier (TP-PID), which can be used to set Replace Type 1-7 (65-71), for example. |
| — ADDITIONAL PARAMETERS FOR PRE-APPROVED TEMPLATES (OPTIONAL) — See §2.1.3 API for OTP, orders and bookings. | |||
| type | Message type | otp, order_confirmation, order_ready, conf_booking, conf_reminder | Not mandatory. Can be used to improve delivery when using pre-approved sender and/or message templates in certain countries. Ignored if the selected route/operator does not require pre-approved sender or template. |
| sendername | Name of company or service sending the message | Text up to 50 characters | Mandatory only if type is one of order_confirmation, order_ready, conf_booking, conf_reminder and when pre-approved template is activated. Used only in countries requiring pre-approved message templates. |
| code | One-time code / password | 4–15 characters Allowed characters: A-Z, a-z, 0-9, ! @ # $ % & * – _ | Mandatory only if type is otp. Used only in countries requiring pre-approved template. For best compatibility with automatic OTP detection on Android and iOS, numeric codes (0–9) of 4–8 characters are recommended. |
| username | Username for OTP | Text up to 255 characters. May contain arbitrary text (username, email or other identifier). URL (http:// or https://) not allowed. | Not mandatory. Used only in OTP messages to countries requiring pre-approved template. If omitted or empty, the corresponding text segment is automatically removed. |
| orderno | Order number | Text up to 50 characters. A-Z, a-z, 0-9 – or _ | Not mandatory. Used only in order confirmations and pickup messages to countries requiring pre-approved template. |
| amount | Total amount for an order | Text up to 50 characters. 0-9 , . – _ or space | Not mandatory. Used only in order confirmations to countries requiring pre-approved template. |
| currency | Currency code or symbol (NOK, €, etc.). | Text up to 10 characters | Not mandatory. Used only in order confirmations to countries requiring pre-approved template. |
| orderurl | Link to an order | Text. Domain must be pre-approved. May be sent as full URL (https://…) or without scheme (companyname.no/…). | Not mandatory. Used only in order confirmations to countries requiring pre-approved template. |
| pax | Number of persons for a booking | Text up to 10 characters. 0-9 , . or space | Not mandatory. Used only in booking confirmations and reminders to countries requiring pre-approved template. |
| date | Booking date | Date in YYYY-MM-DD format, e.g. 2030-01-31 | Not mandatory. Used only in booking confirmations and reminders to countries requiring pre-approved template. |
| time | Time of booking | Time in HH:MM or HH:MM:SS format, e.g. 18:30 or 18:30:00 | Not mandatory. Used only in booking confirmations and reminders to countries requiring pre-approved template. |
| datetime | Booking date and time | ISO 8601 date with time, e.g. 2030-01-31T18:30:00 or 2030-01-31T18:30:00+01:00. Note: Time zones are not converted. | Not mandatory. Used only in booking confirmations and reminders to countries requiring pre-approved template. |
2.1.1 Send Text – HTTP POST (JSON)
Example of sending a text using HTTP POST with a JSON document:
POST /psk/push.php HTTP/1.1
Host: www.pling.as
Content-Type: application/json
{
"serviceid": 3,
"fromid": "26114123450000",
"phoneno": "004799999999",
"txt": "Test æøå ÆØÅ",
"unicode": false
}
Example of sending a text containing an emoji:
POST /psk/push.php HTTP/1.1
Host: www.pling.as
Content-Type: application/json
{
"serviceid": 3,
"fromid": "26114123450000",
"phoneno": "004799999999",
"txt": "Test 🤣",
"unicode": true
}
Example sending a text with all parameters:
POST /psk/push.php HTTP/1.1
Host: www.pling.as
Content-Type: application/json
{
"serviceid": 3,
"fromid": "26114123450000",
"phoneno": "004799999999",
"txt": "Test 🤣",
"unicode": true,
"ref": "3d56c6bd-ffcc-49bb-a815-81b21f082606",
"scheduled": "2024-01-30T13:50:00Z",
"validity": 60,
"flash": false,
"protocolid": 0
}
Example success response when using HTTP POST with a JSON document:
{
"id": 145099,
"errorcode": 0,
"description": "OK"
}
Example error response when using HTTP POST with a JSON document:
{
"id": 0,
"errorcode": 1,
"description": "Invalid mobile number"
}
See §2.2 for a list of error codes.
2.1.2 Send Text – HTTP GET
Example of sending a text using HTTP GET with latin1 percent encoding:
http://www.pling.as/psk/push.php?serviceid=1234&phoneno=004799999999&fromid=26114123450000&txt=Test%20%E6%F8%E5%20%C6%D8%C5
Example of sending a text using HTTP GET with UTF-8 percent encoding:
https://www.pling.as/psk/push.php?serviceid=1234&encoding=utf8&phoneno=004799999999&fromid=26114123450000&txt=Test%20%C3%A6%C3%B8%C3%A5%20%C3%86%C3%98%C3%85
Example of sending a text containing an emoji using HTTP GET with UTF-8 percent encoding:
https://www.pling.as/psk/push.php?serviceid=1234&encoding=utf8&unicode=true&phoneno=004799999999&fromid=26114123450000&txt=Test%20%F0%9F%A4%A3
Example of sending a text with all parameters:
https://www.pling.as/psk/push.php?serviceid=1234&encoding=utf8&unicode=true&phoneno=004799999999&fromid=26114123450000&txt=Test%20%F0%9F%A4%A3&ref=987654321&validity=60&flash=false&protocolid=0&scheduled=2024-01-30T15%3A30%3A00Z
Note: the order of the parameters has no significance.
Example response:
ErrorCode=0, ID=145099
See §2.2 for a list of error codes.
2.1.3 API for OTP, Orders and Bookings
To improve delivery of standard messages globally, Front has extended the SMS Gateway with additional parameters enabling use of pre-approved sender and/or message templates in countries/operators that require this.
Flow:
1. The customer sends txt + fromid as usual (optional: type + template parameters)
2. Front evaluates country, operator and selected route
3a. No restrictions → original message is sent
3b. Restrictions → approved template is used
The original txt is ignored only when a pre-approved template is required by the route/operator.
Important: The parameter "type" is an extension to the existing API and only affects messages sent to countries/routes requiring pre-approved sender or text template.
If the selected route/operator for the recipient number does not require pre-approved sender or template, the message is always sent exactly as provided (txt + fromid).
Use of this functionality is optional.
If parameter "type" is included, Front may — when required by the selected route/operator – use a pre-approved sender and standardized template instead of the customer’s original text.
If optional parameters are not provided, the corresponding text segment will automatically be removed from the message.
Example template:
Your code is <code> Username: <username>. Regards <sendername>.
If only "code" is sent: Your code is 123456
Note: This functionality is intended for customers who want a universal solution without pre-registering their own traffic with operators in each country.
2.1.3.1 OTP – One-Time Code / Verification Code
Template: “Your code is <code> Username: <username> Regards <sendername>»
Example JSON
{
"serviceid": 3,
"fromid": "Firmanavn",
"phoneno": "+4799999999",
"txt": "Din engangskode er 123456\n\nHilsen Firmanavn AS",
"type": "otp",
"code": "123456",
"sendername": "Firmanavn AS",
"username": "bruker@eksempel.no"
}
Example message (Only for route/operator in countries requiring pre-approval, otherwise original text is sent)
Sender: FrontOTP
Your code is 123456
Username: bruker@eksempel.no
Regards Firmanavn AS
Note: For OTP messages, "code" is mandatory. Other lines are omitted when the corresponding parameter is missing.
2.1.3.2 Order Confirmation
Template: Order <orderno> received. Total <currency> <amount>. Link: <orderurl> Thank you from <sendername>.
Example JSON
{
"serviceid": 3,
"fromid": "Firmanavn",
"phoneno": "+4799999999",
"txt": "Takk for handelen hos Firmanavn. Bestillingsnr 123456789, kr 1234,59\nDu finner kvitteringen her:\n tjeneste.no/ordre/123456789",
"type": "order_confirmation",
"sendername": "Firmanavn AS",
"orderno": "123456789",
"amount": "1,234.59",
"currency": "NOK",
"orderurl": "firmanavn.no/123456789"
}
Example message (Only for route/operator in countries requiring pre-approval, otherwise original text is sent)
Sender: FrontOrder
Order 123456789 received. Total NOK 1,234.59. Link: firmanavn.no/123456789
Thank you from Firmanavn AS
Note: For order confirmation, "sendername" is mandatory. Other parts of the text are omitted when corresponding parameters are missing.
2.1.3.3 Pickup Message
Template: Hello! Your order <orderno> is ready for pick up. Best regards, <sendername>.
Example JSON
{
"serviceid": 3,
"fromid": "Firmanavn",
"phoneno": "+4799999999",
"txt": "Bestillingsnr 123456789 er klar og kan hentes. Mvh Firmanavn AS",
"type": "order_ready",
"sendername": "Firmanavn AS",
"orderno": "123456789"
}
Example message (Only for route/operator in countries requiring pre-approval, otherwise original text is sent)
Sender: FrontOrder
Hello! Your order 123456789 is ready for pick up. Best regards, Firmanavn AS.
Note: For pickup messages, "sendername" is mandatory. Order number is omitted if parameter is missing.
2.1.3.4 Booking Confirmation
Template: Your reservation for <pax> at <sendername> on <date> at <time> is confirmed. Welcome!
Example JSON with datetime
{
"serviceid": 3,
"fromid": "Firmanavn",
"phoneno": "+4799999999",
"txt": "Takk for din reservasjon den 31.01.2030 kl 1915 for 4 personer. Mvh Firmanavn AS",
"type": "conf_booking",
"sendername": "Firmanavn AS",
"pax": 4,
"datetime": "2030-01-31T19:15:00+01:00"
}
Example JSON with date and time
{
"serviceid": 3,
"fromid": "Firmanavn",
"phoneno": "+4799999999",
"txt": "Takk for din reservasjon den 31.01.2030 kl 1915 for 4 personer. Mvh Firmanavn AS",
"type": "conf_booking",
"sendername": "Firmanavn AS",
"pax": 4,
"date": "2030-01-31",
"time": "19:15"
}
Example message (Only for route/operator in countries requiring pre-approval, otherwise original text is sent)
Sender: FrontConf
Your reservation for 4 at Firmanavn AS on 31 January 2030
at 19:15 is confirmed. Welcome!
Note: For booking confirmations, "sendername" is mandatory. Other parts of the text are omitted when parameters are missing. Time zones are not converted; use local time, not UTC. If both datetime and date/time are provided, datetime is used.
2.1.3.5 Booking Reminder
Template: We look forward to seeing your party of <pax> on <date> at <time>. Please contact us if there are changes. See you at <sendername>!
Example JSON with date and time
{
"serviceid": 3,
"fromid": "Firmanavn",
"phoneno": "+4799999999",
"txt": "Vi minner om din reservasjon den 31.01.2030 kl 1915 for 4 personer. Dere har bordet til klokken 21:15. Ta kontakt om det er noen endringer. Vi sees, hilsen oss på Firmanavn AS",
"type": "conf_reminder",
"sendername": "Firmanavn AS",
"pax": 4,
"datetime": "2030-01-31T19:15:00+01:00"
}
Example JSON with date and time
{
"serviceid": 3,
"fromid": "Firmanavn",
"phoneno": "+4799999999",
"txt": "Vi minner om din reservasjon den 31.01.2030 kl 1915 for 4 personer. Dere har bordet til klokken 21:15. Ta kontakt om det er noen endringer. Vi sees, hilsen oss på Firmanavn AS",
"type": "conf_reminder",
"sendername": "Firmanavn AS",
"pax": 4,
"date": "2030-01-31",
"time": "19:15"
}
Example message (Only for route/operator in countries requiring pre-approval, otherwise original text is sent)
Sender: FrontConf
We look forward to seeing your party of 4 on 31 January 2030 at 19:15. Please contact us if there are changes. See you at Firmanavn AS!
Note: For booking reminders, "sendername" is mandatory. Other parts are omitted if parameters are missing.
Time zones are not converted; use local time.
If both datetime and date/time are provided, datetime is used.
2.2 ERROR CODES FOR OUTBOUND MESSAGES
When sending the text, the SMS Gateway returns a response to the text you submit. This response consists of an "error code" number and a unique reference ID.
| Error code | Description |
|---|---|
| errorcode=0 | OK (Message is sent) |
| errorcode=1 | Invalid mobile number |
| errorcode=2 | Message sent from unauthorized IP address |
| errorcode=3 | Invalid fromid |
| errorcode=4 | Illegal value SMS |
| errorcode=5 | No remaining SMS messages on account |
| errorcode=6 | No access to premium (charged) messages |
| errorcode=7 | Your account has been blocked by Front, or incorrect serviceid |
| errorcode=8 | serviceid is blank / parameter is missing |
| errorcode=9 | phoneno is blank / missing parameter |
| errorcode=10 | txt is blank / missing parameter |
| errorcode=11 | fromid is blank / missing parameter |
| errorcode=12 | Invalid mobile number premium (overcharged) text |
| errorcode=13 | Invalid password |
| errorcode=14 | The message is too long (max 1530 characters) |
| errorcode=15 | The premium message is too long (max 160 characters). Applies only to premium messages (price > 0) |
| errorcode=16 | The message contains an invalid character. The message can only contain characters in the GSM character set (GSM 03.38). Error code only in use for bulk messages (§2.4). |
| errorcode=17 | Duplicate message. Message with same fromid, phoneno and txt has been sent within the last 120 seconds. |
| errorcode=18 | Encryption required. Use https instead of http. |
| errorcode=19 | Invalid value for the encoding parameter |
| errorcode=20 | The unicode parameter must be "true" or "false" |
| errorcode=21 | Mobile number is blacklisted. The mobile number is known to be invalid for receiving SMS or has been previously seen in connection with misuse. |
| errorcode=22 | flash parameter must be "true" or "false" |
| errorcode=23 | protocolid must be an integer between 0 and 255 |
| errorcode=24 | validity must be a positive integer |
| errorcode=25 | ref cannot exceed 100 characters |
| errorcode=26 | scheduled must be an ISO 8601 formatted datetime in the future |
| errorcode=27 | group must be the name of a contact group containing at least one contact |
| errorcode=28 | type must be one of "otp", "order_confirmation", "order_ready", "conf_booking", "conf_reminder" |
| errorcode=29 | code is required for otp messages and must be 4 – 15 characters |
| errorcode=30 | sendername missing or invalid |
| errorcode=31 | orderno invalid |
| errorcode=32 | amount invalid |
| errorcode=33 | currency invalid |
| errorcode=34 | orderurl invalid |
| errorcode=35 | pax invalid |
| errorcode=36 | date invalid |
| errorcode=37 | time invalid |
| errorcode=38 | datetime invalid |
| errorcode=39 | username invalid |
Please note that new error codes may be added in future versions.
2.3 DELIVERY STATUS FOR OUTBOUND MESSAGES
The delivery status of a message is continuously posted to the URL you have configured to receive it. This service is optional.
| Parameter | Description | Legal Values | Comment |
|---|---|---|---|
| status | New status on SMS | -1, 4, 5 | See below |
| origid | ID Reference Number | Same number as confirmation ID when the message was sent | Unique number for each text message |
| ref | Your reference | text up to 100 characters | The "ref" that was supplied when the text was sent |
| phoneno | Mobile number the text was sent to | E164 phone number | Only included when "ref" was supplied |
https://customer.no/sms?status=4&origid=14509
Sample status with ref: https://customer.no/sms?status=4&origid=14509&ref=abc&phoneno=%2B4799999999
Status -1:
The message is received by the carrier but not delivered to the mobile phone. Note: this status can come after status 4 if the message is delivered immediately.
Status 4:
The message has been received by the recipient’s mobile phone. It is not known whether the recipient has read the message
Status 5:
The message has failed. In most cases this is due to that sending a message to a mobile phone number not in use. May also occur due to operational errors among telecom operators.
If no status is received, this normally indicates that the message is still in transit. The most common reason for not attaining the status is that the recipient has turned off his cell phone or located in an area without coverage. It happens that one does not get any status even if the message is actually delivered.
2.4 OUTBOUND MESSAGES – BULK
To send a text message to multiple recipients, use an HTTP Post to the following URL: https://www.pling.as/psk/push_bulk.php
The request body must be a valid JSON document (http://json.org) with the following structure:
| Parameter | Description | Allowed values | Comment |
|---|---|---|---|
| serviceid | Server identifier | Unique customer ID | Required; number |
| phoneno | Recipients’ mobile numbers. | International telephone number with country code. 004799999999 | Optional; string array; One of "phoneno" and "group" is required |
| group | Contact group name | Exact name of a contact group containing at least one active contact. | Optional; string; One of "phoneno" and "group" is required |
| txt | Message text to be sent | Text containing only characters in the GSM character set (GSM 03.38). | Required. A message consists of 160 characters. If a message contains more, it counts as multiple SMS. Each SMS is then a length of 153 characters. Max is 1530. |
| fromid | Unique sender ID | An assigned number / serial number from Front or assigned sender text, maximum 11 characters. | Required; string |
| unicode | Allow sending of Unicode texts | true, false | Optional; boolean. By default, all texts are sent using the GSM character set (GSM 03.38), and texts with non-supported characters are rejected. When “unicode” is true, all characters (emoji, etc.) are allowed. The text will only be sent as Unicode if it contains characters not found in the GSM character set. |
| ref | Your ID or reference | text, max 100 characters or an integer | Optional. If ref is included in the request, the ref and phoneno will be included in the delivery status report |
| scheduled | Date and time to send the text | ISO 8601 datetime, e.g. 2024-01-30T14:40:00Z | Optional. Must be in the future Default value: immediate. UTC is assumed if no time zone is supplied. |
| validity | Validity period in minutes | positive integer | Optional. Default value: 1 week in minutes. Validity period is how long the carrier should attempt to deliver the text before failing when the recipient is not connected to the mobile network (phone turned off, no coverage, SIM card removed, etc.). The carrier’s maximal validity period is used when it is shorter than the supplied value. |
| flash | Flash message | true, false | Optional. Default value: false. Attempt to send the text as Flash SMS that is displayed directly on the main screen without user interaction. Not supported by all carriers. |
| protocolid | GSM Protocol Identifier (TP-PID) | 0 – 255 | Optional. Default value: 0. Attempt to send with GSM Protocol Identifier (TP-PID), which can be used to set Replace Type 1-7 (65-71), for example. |
The server will accept the request as long as there is at least one valid recipient, and the other parameters are valid.
The server responds with HTTP status code 201 (Created) if the message has been accepted. All other status codes indicate that the message was not accepted, and the message will not be sent. The response body includes an error code, description and lists with any invalid or duplicate mobile numbers as a JSON document.
Examples
Example bulk request:
{
"serviceid": 1234,
"phoneno": ["004799999999", "004799999998"],
"txt": "Test æøå Æøå",
"fromid": "My Company"
}
Example bulk request with emoji:
{
"serviceid": 1234,
"phoneno": ["004799999999", "004799999998"],
"txt": "Test 🤣",
"unicode": true,
"fromid": "My Company"
}
Example bulk request with all parameters:
{
"serviceid": 1234,
"phoneno": ["004799999999", "004799999998"],
"txt": "Test 🤣",
"unicode": true,
"fromid": "Mitt Firma",
"ref": "3d56c6bd-ffcc-49bb-a815-81b21f082606",
"scheduled": "2024-01-30T13:50:00Z",
"validity": 60,
"flash": false,
"protocolid": 0
}
Example response body:
{
"errorcode": 0,
"description": "OK",
"invalidPhoneno": [],
"duplicatePhoneno": []
}
Please note that the response does not include a reference number (ID) for the messages that will be sent. Please include a "ref" with bulk outbound messages to receive delivery status reports that contain a "ref" and "phoneno" to identify the text. (see §2.2 – 2.3).
2.5 INCOMING MESSAGES (Only with module “Two-way Messaging”)
The SMS Gateway can be configured at https://login.pling.as/pling/gateway (login required). The URL where received texts are delivered can be configured there, along with the API to be used. To ensure optimal security and comply with privacy regulations, we recommend that the URL uses HTTPS and only accepts requests from Front’s SMS Gateway IP addresses (currently 18.197.36.176, 18.197.110.183 and 18.197.138.46).
2.5.1 INCOMING MESSAGES – HTTP POST JSON API
When the HTTP POST JSON API is configured, incoming messages are delivered to the configured URL as a JSON document using HTTP POST.
Message JSON
The message is posted as a JSON document (http://json.org/) with the following fields:
| Parameter | Type | Description |
|---|---|---|
| id | Number | Front’s unique identifier for the message |
| to | String | Telephone number to which the message was sent in either E164 format (e.g. "+47594400"), national format for short code (e.g. "26114") or short code with sub-number (e.g. "26114123456789") |
| from | String | Telephone number from which the message was sent in E164 format (e.g. "+4799999999"). In rare instances this can be a nationally formatted number (e.g. "26114") or a text (e.g. "HelloWorld") of up to 11 characters. |
| text | String | The message body. In the case of a multimedia message, the subject (if present) and any plain text files included in the message will be concatenated with a newline separator to form the text. Refer to SMIL file for the proper display of the individual text files. |
| sent | String | The ISO 8601 formatted timestamp when the message was sent or first received by Front (e.g. "2020-12-31T23:59:59Z") |
| counter | Number | A counter value that is incremented for each message received at your SMS Gateway. This can be useful for detecting missing messages, etc. |
| keyword | String | The first word in the message, which is often used when routing messages sent to a short number to the appropriate recipient. |
| files | Array | The files included in a multimedia message (MMS). See below for the definition of the file object. This is an empty array for a normal text (SMS). * |
* Please note that support for multimedia messages (MMS) is an additional service that is not enabled by default on your account. In this case, the "files" field can be safely ignored, including the File JSON definition below. Please contact Front if you require MMS functionality.
File JSON
Each file in the files array consists of an object with following fields:
| Parameter | Type | Description |
|---|---|---|
| id | Number | Front’s unique identifier for the file |
| contentType | String | The MIME type of the file as specified in the MMS |
| fileName | String | The file name as specified in the MMS |
| fileData | String | The file’s binary data: Base64 encoding. |
Expected Response
Any HTTP response sent with a 2xx (success) status code will be interpreted as successful delivery of the message. For example, 200 (OK), 201 (Created), 202 (Accepted) and 204 (No Content) are all acceptable HTTP Status codes.
An HTTP response sent with any other status code is considered an unsuccessful delivery of the message. Also, the lack of a response within 60 seconds is treated as a timeout and is also considered an unsuccessful delivery.
Examples
Example of a text (SMS) received at short code:
{
"id": 999999,
"to": "26114",
"from": "+479999999",
"text": "Test 123",
"sent": "2019-12-31T23:59:59Z",
"counter": 7166,
"keyword": "TEST",
"files": []
}
Example of a multimedia message (MMS) received at long code:
{
"id": 999999,
"to": "+4759440000",
"from": "+479999999",
"text": "Test 123",
"sent": "2019-12-31T23:59:59Z",
"counter": 7166,
"keyword": "TEST",
"files": [
{
"id": 4747,
"contentType": "text/xml;Name=smil.xml;Charset=UTF-8",
"fileName": "smil.xml",
"fileData": "PD94bWwgdmVyc2lvbj0iMS4wIj48c21pbD..."
},
{
"id": 4748,
"contentType": "text/plain;Name=text_75329.txt;Charset=UTF-8",
"fileName": "text_175329.txt",
"fileData": "VGVzdCAxMjM="
},
{
"id": 4749,
"contentType": "image/jpeg;Name=image01.jpg",
"fileName": "image01.jpg",
"fileData": "w4PCv8ODwpjDg8K/w4PCoAAQSkZJRgABAQ..."
}]
}
2.5.2 INCOMING MESSAGES – HTTP GET API
When the HTTP GET API is configured, incoming messages are delivered to the configured using an HTTP GET request with the message data as query string values. The parameter values are percent encoded using the latin1 (ISO-8859-1) character set. Characters that cannot be encoding as latin1 are converted to "?" before being encoded.
The following parameters are used in the HTTP GET API for incoming messages:
| Parameter | Description |
|---|---|
| fromid | Telephone number to which the message was sent in either as an international number (e.g. "47594400"), a short code (e.g. "26114") or the sub-number for short code with sub-number (e.g. "123456789" for "26114123456789") |
| phonenr | Telephone number from which the message was sent in international format with leading zeros (e.g. "004799999999"). In rare instances this can be a nationally formatted number (e.g. "26114") or a text (e.g. "HelloWorld") of up to 11 characters. |
| txt | The text of the message |
| time | Time message was received, unix code |
| countnr | A counter value that is incremented for each message received at your SMS Gateway. This can be useful for detecting missing messages, etc. |
| code | The first word in the message, which is often used when routing messages sent to a short number to the appropriate recipient. |
The expected response for a successfully processed request is the text:
true
Example of an incoming message using the HTTP GET API:
https://www.customer.no/innkommende/?fromid=123450000&phonenr=004799999999&txt=Test%20%E6%F8%E5%20%C6%D8%C5&time=1077181484&countnr=157&code=TEST
3 Document History
v2.20 (2016-06-19): OUTBOUND MESSAGES – BULK added.
v2.21 (2017-03-15): DELIVERY STATUS OF OUTGOING PUSH MESSAGES updated with correct max length for error code 14. Error code 15 and 16 added.
v2.22 (2017-03-15): Duplicate message check. New SMS Gateways will be configured with a duplicate message check. Information about error code 17 added.
v2.23 (2020-03-09): Increased maximum length for message text to 1024 characters.
v2.24 (2020-04-29)
- Improved descriptions in section 1
- Added support for HTTP POST of JSON document when sending single text
- Added unicode parameter to allow sending Unicode texts
- Added encoding parameter when sending texts using HTTP GET
- Added more examples of sending texts
- Added information about error codes 18, 19, 20
- Added HTTP POST JSON API for incoming messages
- Improve description of the parameters for the HTTP GET API for incoming messages
v2.25 (2021-12-15): New error code when mobile number is blacklisted.
v2.26 (2022-02-01): Remove mobile number from registration form
v3.02 (2023-07-11)
- Added ref, scheduled, validity, flash and protocolid to outbound messages.
- Added ref and phoneno to delivery status reports (only when ref is supplied when sending)
V3.03 (2023-08-17): Increased maximum length for message text to 1530 characters.
V3.04 (2024-06-05): Added group to bulk outbound messages.
v3.05 (01.03.2026): API for OTP, orders and bookings (optional additional parameters)