MessageBird’s SMS API allows you to send and receive SMS messages to and from any country in the world through a REST API. Each message is identified by a unique random ID so that users can always check the status of a message using the given endpoint.
The SMS API uses HTTP verbs and a RESTful endpoint structure with an access key that is used as the API Authorization. Request and response payloads are formatted as JSON using UTF-8 encoding and URL encoded values.
Excessive HTTP requests will be rejected with status code 429 Too Many Requests. When you receive a 429 response, you can safely assume that the request has not been processed, and can be retried at a later time. Please reduce the rate of your requests and try the request again later.
Please contact support in case you need higher limits.
HTTP Method | Limit |
---|---|
GET | 50 req/s |
POST | 500 req/s |
PATCH | 50 req/s |
DELETE | 50 req/s |
This is an object representing an SMS message at MessageBird.com.
Attribute | Type | Description |
---|---|---|
id | string | A unique random ID which is created on the MessageBird platform and is returned upon creation of the object. |
href | string | The URL of the created object. |
direction | string | Tells you if the message is sent or received. mt: mobile terminated (sent to mobile) mo: mobile originated (received from mobile) |
type | string | The type of message. Values can be: sms, binary, or flash |
originator | string | The sender of the message. This can be a telephone number (including country code) or an alphanumeric string. In case of an alphanumeric string, the maximum length is 11 characters. You can set a default originator in your account or use inbox to use the Sticky VMN feature. |
body | string | The body of the SMS message. |
reference | string | A client reference. |
reportUrl | string | The status report URL to be used on a per-message basis. reference is required for a status report webhook to be sent. |
validity | integer | The amount of seconds that the message is valid. If a message is not delivered within this time, the message will be discarded. |
gateway | integer | The SMS route that is used to send the message. |
typeDetails | hashmap | A hashmap with extra information. Further explanation in the table below. |
datacoding | string | The datacoding used, defaults to plain (GSM 03.38 characters only), or it can be set to unicode (contains non-GSM 03.38 characters) or set to auto and we will set unicode or plain depending on the body content. Note: Using unicode will limit the maximum number of characters to 70 instead of 160. If message character size exceeds the limit, messages will be concatenated, resulting in separately billed messages. See this article for more information. |
mclass | integer | Indicated the message type. 1 is a normal message, 0 is a flash message. (0-3 are valid values) |
scheduledDatetime | datetime | The scheduled date and time of the message in RFC3339 format (Y-m-d\TH:i:sP) |
createdDatetime | datetime | The date and time of the creation of the message in RFC3339 format (Y-m-d\TH:i:sP) |
recipients | hashmap | The hashmap with recipient information. Further explanation in the table below. |
{"id":"e8077d803532c0b5937c639b60216938","href":"https://rest.messagebird.com/messages/e8077d803532c0b5937c639b60216938","direction":"mt","type":"sms","originator":"MessageBird","body":"The message to be sent","reference":"the-client-reference","validity":null,"gateway":240,"typeDetails":{},"datacoding":"plain","mclass":1,"scheduledDatetime":null,"createdDatetime":"2016-04-29T09:42:26+00:00","recipients":{"totalCount":1,"totalSentCount":1,"totalDeliveredCount":1,"totalDeliveryFailedCount":0,"items":[{"recipient":31612345678,"status":"sent","statusReason":"successfully delivered","statusErrorCode":null,"statusDatetime":"2016-04-29T09:42:26+00:00","recipientCountry":"Netherlands","recipientCountryPrefix":31,"recipientOperator":"KPN","mccmnc":"20408","mcc":"204","mnc":"08","messageLength":22,"messagePartCount":1,"price":{"amount":0.075,"currency":"EUR"}}]}}
Attribute | Type | Description |
---|---|---|
totalCount | integer | The total count of recipients. |
totalSentCount | integer | The count of recipients that have the message pending (status sent, and buffered). |
totalDeliveredCount | integer | The count of recipients where the message is delivered (status delivered). |
totalDeliveryFailedCount | integer | The count of recipients where the delivery has failed (status delivery_failed). |
items | array | An array of recipient hashmaps. Further explanation in the table below. |
Attribute | Type | Description |
---|---|---|
recipient | integer | The msisdn of the recipient |
status | string | The status of the message sent to the recipient. Possible values: scheduled, sent, buffered, delivered, expired, and delivery_failed |
statusReason | string | The details about the message status. Possible values: successfully delivered, pending DLR, DLR not received, unknown subscriber, unavailable subscriber, expired, opted out, received network error, insufficient balance, carrier rejected, capacity limit reached and generic delivery failure. Read more about status reasons. |
statusErrorCode | integer | null | Extra error code that describes the failure in more detail (optional, null if not available) |
statusDatetime | datetime | The date and time of the last status in RFC3339 format (Y-m-d\TH:i:sP) |
recipientCountry | string | The name of the recipient’s original country, based on MSISDN. |
recipientCountryPrefix | integer | The prefix code for the recipient’s original country, based on MSISDN. |
recipientOperator | string | The name of the operator of the recipient. Identified by MCCMNC of the message. |
mccmnc | string | null | The code of the operator of the message sender. It could have null value if the message isn’t delivered yet. |
mcc | string | null | The MCC (Mobile Country Code) part of MCCMNC. |
mnc | string | null | The MNC (Mobile Network Code) part of MCCMNC. |
messageLength | integer | The length of the message in characters. Depends on the message datacoding. |
messagePartCount | integer | The count of total messages send. Personalisation not taken in account. |
price | hashmap | A hashmap with extra information about how much the message costs. Note: see this article for more details about our pricing policy. |
price.amount | float | null | The price the message was billed with. It could have a null value if the message isn’t billed yet. |
price.currency | string | null | The alphabetic code of the price currency, in ISO 4217 format. It could have null value if the message isn’t billed yet. |
Attribute | Type | Description |
---|---|---|
udh | string | The UDH to prepend to the message payload. This can be used for sending concatenated SMS. Often required to send binary messages. |
{"id":"98154fa03532c2c3fc7b341b46487018","href":"https://rest.messagebird.com/messages/98154fa03532c2c3fc7b341b46487018","direction":"mt","type":"binary","originator":"MessageBird","body":"546865206d65737361676520746f2062652073656e74","reference":null,"validity":null,"gateway":240,"typeDetails":{"udh":"050003340201"},"datacoding":"plain","mclass":1,"scheduledDatetime":null,"createdDatetime":"2016-04-29T09:42:26+00:00","recipients":{"totalCount":2,"totalSentCount":1,"totalDeliveredCount":1,"totalDeliveryFailedCount":0,"items":[{"recipient":31612345678,"status":"sent","statusReason":"successfully delivered","statusErrorCode":null,"statusDatetime":"2016-04-29T09:42:26+00:00","recipientCountry":"Netherlands","recipientCountryPrefix":31,"recipientOperator":"KPN","mccmnc":"20408","mcc":"204","mnc":"08","messageLength":44,"messagePartCount":1,"price":{"amount":0.075,"currency":"EUR"}},{"recipient":31612345679,"status":"delivery_failed","statusReason":"unknown subscriber","statusErrorCode":1,"statusDatetime":"2016-04-29T09:42:26+00:00","recipientCountry":"Netherlands","recipientCountryPrefix":31,"recipientOperator":"","mccmnc":null,"mcc":null,"mnc":null,"messageLength":44,"messagePartCount":1,"price":{"amount":null,"currency":null}}]}}
MessageBird's Programmable SMS API enables you to programmatically send SMS messages from your web application.
First, you need to create a new message object. MessageBird returns the created message object with each request. A maximum of 50 recipients can be entered per request.
Send your first SMS message with this example request.
Sticky VMN's ensure that the same Sender phone number is selected each time a specific recipient receives an SMS from your web application.
Sticky VMN's are only available in Canada, Netherlands and United Kingdom. As there are no capacity limits in other countries, you won't need multiple VMNs. Learn more about specific country restrictions. Starting 1st March 2022 the services has been discontinued in the USA following a change in regulation.
Whether you are using a pool of dedicated VMNs or MessageBird's shared VMN pool, it is best practice to ensure that your recipients always receive your SMS messages from the same VMN as a sender.
MessageBird's Sticky-VMN-as-a-Sender service makes this configuration possible. Simply use inbox as the originator when sending SMS messages to the MessageBird SMS API.
This will trigger our system to select a random VMN (dedicated or shared - depending on what’s available) for the first SMS message and ensure that the selected VMN be reused for all following SMS messages.
attribute | type | description |
---|---|---|
originator | string | The sender of the message. This can be a telephone number (including country code) or an alphanumeric string. In case of an alphanumeric string, the maximum length is 11 characters. |
body | string | The body of the SMS message. |
recipients | array | An array of recipients msisdns. |
attribute | type | description |
---|---|---|
groupIds | array | An array of group id's. If provided recipients can be omitted. |
type | string | The type of message. Values can be: sms, binary, or flash. |
reference | string | A client reference. Is required for a status report callback to be sent |
reportUrl | string | The status report URL to be used on a per-message basis. This value overrides the standard status report url configured on the customer account. |
validity | integer | The amount of seconds that the message is valid. If a message is not delivered within this time, the message will be discarded. |
gateway | integer | The SMS route that is used to send the message. |
typeDetails | hashmap | A hashmap with extra information. Is only used when a binary message is sent. |
datacoding | string | The datacoding used can be plain (GSM 03.38 characters only), unicode (contains non-GSM 03.38 characters) or auto: we will then set unicode or plain depending on the body content. Note: Using unicode will limit the maximum number of characters to 70 instead of 160. If message character size exceeds the limit, messages will be concatenated, resulting in separately billed messages. See this article for more information. |
mclass | integer | Indicated the message type. 1 is a normal message, 0 is a flash message. (0-3 are valid values) |
shortenUrls | boolean | beta Shorten all the URLs present in the message body. |
scheduledDatetime | datetime | The scheduled date and time of the message in RFC3339 format (Y-m-d\TH:i:sP), when you want to schedule a message in the future. Don't set this value when message needs to be send directly. |
createdDatetime | datetime | The date and time of the creation of the message in RFC3339 format (Y-m-d\TH:i:sP) |
POST https://rest.messagebird.com/messages
curl -X POST https://rest.messagebird.com/messages \-H 'Authorization: AccessKey test_gshuPaZoeEG6ovbc8M79w0QyM' \-d "recipients=31612345678" \-d "originator=YourName" \-d "shortcode=1008" \-d "body=This is a test message"
Do note that values are not automatically urlencoded with the above example. Use --data-urlencode if you want to urlencode the values.
{"id":"e8077d803532c0b5937c639b60216938","href":"https://rest.messagebird.com/messages/e8077d803532c0b5937c639b60216938","direction":"mt","type":"sms","originator":"YourName","body":"This is a test message","reference":null,"validity":null,"gateway":null,"typeDetails":{},"datacoding":"plain","mclass":1,"scheduledDatetime":null,"createdDatetime":"2016-05-03T14:26:57+00:00","recipients":{"totalCount":1,"totalSentCount":1,"totalDeliveredCount":0,"totalDeliveryFailedCount":0,"items":[{"recipient":31612345678,"status":"sent","statusDatetime":"2016-05-03T14:26:57+00:00"}]}}
Status reports are HTTP GET requests that are sent to your platform. The requests hold information about the status of a message that you have sent through our API. Status reports are only provided for SMS messages that have a reference defined when sending the message, and a status report URL is set: as reportUrl when sending the message, or configured in their account as status report url.
Note: New attributes can be added to the status report HTTP callbacks. Consider this for the validation of received from MessageBird status reports. We will never remove attributes.
Attribute | Type | Description |
---|---|---|
id | string | A unique random ID which is created on the MessageBird platform and is returned upon creation of the object. |
reference | string | A reference, given by customer when sending the message to the MessageBird platform. |
recipient | string | The recipient where this status report applies to. |
status | string | The status of the message sent to the recipient. Possible values: scheduled, sent, buffered, delivered, expired, and delivery_failed. |
statusReason | string | The details about the message status. Possible values: successfully delivered, pending DLR, DLR not received, unknown subscriber, unavailable subscriber, expired, opted out, received network error, insufficient balance, carrier rejected, capacity limit reached and generic delivery failure. Read more about status reasons. |
statusErrorCode | integer | Extra error code that describes the failure in more detail (optional, only given if available). |
statusDatetime | datetime | The date and time of this status in RFC3339 format (Y-m-d\TH:i:sP). |
mccmnc | integer | The code of the operator of the message recipient number. |
ported | boolean | Indicates if the recipient number was ported from another operator. |
messageLength | integer | The length of the message in characters. Depends on the message datacoding. |
messagePartCount | integer | The count of total messages sent. |
datacoding | string | The encoding of the message. Possible values: plain, unicode. |
price.amount | float | null | The price the message was billed with. It could have a null value if the message isn’t billed yet. |
price.currency | string | null | The alphabetic code of the price currency, in ISO 4217 format. Possible values are also CRE, TRC for internal (free) credits currency. It could have a null value if the message isn’t billed yet. |
Your platform should respond with a 200 OK HTTP header. When our platform doesn't receive a 200 OK header, we will try to deliver the receipt again (up to 10 times).
GET http://your-own.url/script?id=efa6405d518d4c0c88cce11f7db775fb&reference=the-customers-reference&recipient=31612345678&status=delivered&statusReason=successfully%20delivered&statusDatetime=2017-09-01T10:00:05+00:00&datacoding=plain&mccmnc=20409&messageLength=44&messagePartCount=1&ported=0&price[amount]=0.75&price[currency]=EUR
200 OK
Inbound SMS messages from a Virtual Mobile Number are received through a callback URL that can be configured manually by using the Forward to URL step in Flow Builder, or by contacting our support team. The message attributes are sent through a POST request by default but the method can be configured per VMN.
Attribute | Type | Description |
---|---|---|
id | string | A unique random ID which is created on the MessageBird platform. |
recipient | string | The recipient of the message (the VMN). |
originator | string | The sender of the message. |
body | string | The body of the SMS message. |
createdDatetime | datetime | The date and time of the creation of the message in RFC3339 format (Y-m-d\TH:i:sP) |
Inbound SMS messages from an end user to - a (sub)keyword at - a shortcode are received through a configured callback URL (configurable per keyword/shortcode). The message attributes are sent through a GET request by default but the method can be configured per keyword. Please contact our support team to set this up for you.
Attribute | Type | Description |
---|---|---|
mid | integer | A unique random ID which is created on the MessageBird platform. |
shortcode | string | The shortcode that received the message. |
keyword | string | The keyword that matched the message. |
originator | string | The sender of the message (end user). |
operator | integer | The operator of the sender of the message (MCCMNC) |
message | string | The body of the SMS message, including the (sub)keyword. |
receive_datetime | string | The date and time when the message was received at shortcode in format: YmdHis |
You can use MessageBird's SMS API to retrieve information of an existing inbound or outbound SMS message.
You only need to supply the unique message id that was returned upon creation or receiving.
Parameter | Type | Description |
---|---|---|
id | string | A unique random ID which is created on the MessageBird platform and is returned upon creation of the object. Required |
This will return a message object if the request was successful.
If the request failed, an error object will be returned.
{"id":"e8077d803532c0b5937c639b60216938","href":"https://rest.messagebird.com/messages/e8077d803532c0b5937c639b60216938","direction":"mt","type":"sms","originator":"YourName","body":"This is a test message","reference":null,"validity":null,"gateway":null,"typeDetails":{},"datacoding":"plain","mclass":1,"scheduledDatetime":null,"createdDatetime":"2016-05-03T14:26:57+00:00","recipients":{"totalCount":1,"totalSentCount":1,"totalDeliveredCount":0,"totalDeliveryFailedCount":0,"items":[{"recipient":31612345678,"status":"sent","statusReason":"successfully delivered","statusErrorCode":null,"statusDatetime":"2016-05-03T14:26:57+00:00","recipientCountry":"Netherlands","recipientCountryPrefix":31,"recipientOperator":"KPN","mccmnc":"20408","mcc":"204","mnc":"08","messageLength":22,"messagePartCount":1,"price":{"amount":0.75,"currency":"EUR"}}]}}
To list all inbound and outbound SMS messages, you can do a GET request on the /messages endpoint.
Messages are identified by a unique random ID. You can use this ID to check the status of the SMS message through the provided endpoint.
https://rest.messagebird.com/messages?status=scheduled
curl -X GET https://rest.messagebird.com/messages \-H 'Authorization: AccessKey test_gshuPaZoeEG6ovbc8M79w0QyM'
{"offset": 0,"limit": 20,"count": 4,"totalCount": 4,"links": {"first": "https://rest.messagebird.com/messages/?offset=0","previous": null,"next": null,"last": "https://rest.messagebird.com/messages/?offset=0"},"items": [{"id": "436d780b854749b4beca51623d9e2674","href": "https://rest.messagebird.com/messages/436d780b854749b4beca51623d9e2674","direction": "mt","type": "sms","originator": "YourName","body": "This is a test message","reference": null,"validity": null,"gateway": 10,"typeDetails": {},"datacoding": "plain","mclass": 1,"scheduledDatetime": null,"createdDatetime": "2020-02-04T19:01:12+00:00","recipients": {"totalCount": 1,"totalSentCount": 1,"totalDeliveredCount": 1,"totalDeliveryFailedCount": 0,"items": [{"recipient": 31612345678,"originator": null,"status": "delivered","statusReason": "successfully delivered","statusErrorCode": null,"statusDatetime": "2020-02-04T19:01:12+00:00","recipientCountry": "Netherlands","recipientCountryPrefix": 31,"recipientOperator": "KPN","mccmnc": "20408","mcc": "204","mnc": "08","messageLength": 22,"messagePartCount": 1,"price": {"amount": 0.075,"currency": "EUR"}}]}}]}
Besides listing all SMS messages, the MessageBird SMS API also provides some filters that can be used as query parameters:
Filter | Type | Description |
---|---|---|
originator | string | Display messages by the specified originator. |
recipient | string | Display messages for the specified recipient. |
direction | string | Display either mt (sent) or mo (received) messages. |
limit | int | Limit the amount of messages listed. |
offset | int | Skip first n results. |
searchterm | string | Display messages including the specified searchterm in recipient and originator |
type | string | Display messages of type sms, binary, or flash |
contact_id | int | Display messages by contact_id. See Contacts API for more info. |
status | string | Display messages with status scheduled, sent, buffered, delivered, expired, or delivery_failed. |
from | datetime | Display messages starting from the specified date in RFC3339 format (Y-m-d\TH:i:sP). |
until | datetime | Display messages until the specified date in RFC3339 format (Y-m-d\TH:i:sP). |
You can also list all scheduled SMS messages using the endpoint on the right.
https://rest.messagebird.com/messages?status=scheduled
curl -X GET https://rest.messagebird.com/messages?status=scheduled \-H 'Authorization: AccessKey test_gshuPaZoeEG6ovbc8M79w0QyM'
{"offset":0,"limit":20,"count":1,"totalCount":1,"links":{"first":"https://rest.messagebird.com/messages/?offset=0&status=scheduled","previous":null,"next":null,"last":"https://rest.messagebird.com/messages/?offset=0&status=scheduled"},"items":[{"id":"","href":"https://rest.messagebird.com/messages/","direction":"mt","type":"sms","originator":"Test","body":"test mesage","reference":null,"validity":null,"gateway":10,"typeDetails":{},"datacoding":"plain","mclass":1,"scheduledDatetime":"2020-04-04T13:14:00+00:00","createdDatetime":"2020-03-04T13:06:20+00:00","recipients":{"totalCount":0,"totalSentCount":0,"totalDeliveredCount":0,"totalDeliveryFailedCount":0,"items":[]}}]}
MessageBird provides three levels of information describing the status of an SMS: Status, Status Reason, and Error Code. These levels are complementary and should be analyzed together to get the full picture of an SMS delivery.
The Status, Status Reason and Error Code are reported back as respectively status, statusReason and statusErrorCode variables in the HTTP status report callback. The Error Code is only given when the data is available.
When connected via SMPP, the Error Code is given back as value of the network_error_code TLV and in the err parameter in a DLR’s short_message value. It contains the code that references a specific error.
SMS Error Codes are grouped in Status Reasons, that in turn provide additional details to an SMS Status. To read more about the relationship between Statuses, Status Reasons, and Error Codes you can check our support article. The error codes descriptions can be found in the table below.
Some Statuses, Reasons and Error Codes are related to country restrictions. You can find more information about countries restrictions at our help pages.
Code | Name | Description |
---|---|---|
0 | EC_NO_ERROR | - |
1 | EC_UNKNOWN_SUBSCRIBER | Permanent; The receiver number is not associated with an active line. |
2 | EC_UNKNOWN_BASE_STATION | Permanent; The receiver number is currently attached to an equipment unknown to the receiving network. |
3 | EC_UNKOWN_MSC | Intermediate; The receiver number is currently attached to an equipment unknown to the receiving network. |
5 | EC_UNIDENTIFIED_SUBSCRIBER | Intermediate; The receiver number is not associated with an active line. |
7 | EC_UNKNOWN_EQUIPMENT | Intermediate; The receiver number is valid but its handset is not able to connect to the mobile network. |
8 | EC_ROAMING_NOT_ALLOWED | Intermediate; The receiver is currently outside of its network of origin and it is not authorised to roam. The issue will resolve once it returns. |
9 | EC_ILLEGAL_SUBSCRIBER | Permanent; The receiver failed to authenticate when connecting to the mobile network. |
10 | EC_BEARERSERVICE_NOT_PROVISIONED | Intermediate; The receiver number bearer is not provisioned for SMS. This could be because the subscriber have 2 active numbers (dual numbering) and the one used as receiver is not SMS enable (but the other is). |
11 | EC_TELESERVICE_NOT_PROVISIONED | Intermediate; The receiver is not provisioned for SMS this could be because the number is a not a mobile (i.e. is a IoT number) and/or the subscriber plan do not allow SMS. |
12 | EC_ILLEGAL_EQUIPMENT | Intermediate; The receiver number is valid but its handset is blacklisted as stolen/lost. |
13 | EC_CALL_BARRED | Intermediate; The SMS services have been blocked by the receiver operator. This is usually linked to an unpaid bill or lack of credit. |
21 | EC_FACILITY_NOT_SUPPORTED | Intermediate; The SMS is failing due to the receiving network not supporting SMS. |
26 | EC_SUBSEQUENT_HANDOVER_FAILURE | Intermediate; The receiver is currently moving between different areas of its network and the SMS couldn't be delivered. |
27 | EC_ABSENT_SUBSCRIBER | Intermediate; The receiver couldn't be located on the receiver network. |
28 | EC_ABSENT_SUBSCRIBER_NO_PAGE | Intermediate; The receiver is out of coverage. |
29 | EC_ABSENT_SUBSCRIBER_IMSI_DETACHED | Intermediate; The receiver switched its handset off. |
30 | EC_CONTROLLING_MSC_FAILURE | Intermediate; The network equipment the receiver is attached to is experiencing a temporary failure and/or planned maintenance. |
31 | EC_SUBSCRIBER_BUSY_FOR_MT_SMS | Intermediate; The receiver is currently busy (example performing USSD) and the SMS could not be delivered. |
32 | EC_SM_DELIVERY_FAILURE | Intermediate |
33 | EC_MESSAGE_WAITING_LIST_FULL | Intermediate; The receiver has received more SMS then then local network nodes can store for a single user. |
34 | EC_SYSTEM_FAILURE | Intermediate; A generic issue with the receiver network. |
35 | EC_DATA_MISSING | Intermediate; A mandatory (by the receiver network) field was empty. |
36 | EC_UNEXPECTED_DATA_VALUE | Intermediate; Value in one the SMS fields was wrong (i.e. the charset used for coding the SMS). |
39 | EC_NO_ROAMING_NUMBER_AVAILABLE | Intermediate; The receiver is roaming and a temporary roaming redirecting number was not available to be assigned to reroute the SMS to the correct country/destination. |
40 | EC_MEMORY_CAPACITY_EXCEEDED | Intermediate; An unspecified equipment on the receiving network has no memory left to handle incoming SMS traffic. |
71 | EC_UNKNOWN_ALPHABET | Permanent; The SMS is written in an alphabet/charset that is not supported by the receiving network. |
72 | EC_USSD_BUSY | Intermediate |
101 | EC_SUBSCRIBER_INSUFFICIENT_BALANCE | Intermediate |
103 | EC_SUBSCRIBER_OPTEDOUT | Permanent; The receiver opted out from receiving SMS all future SMS will be blocked. This error can only be solved by the subscriber sending an opt-in keyword like 'START'. |
104 | EC_SENDER_UNREGISTERED | Permanent; The originator used in sending the SMS is not allowed by the receiving mobile operator, this is usually caused by a lack of registration. Please consult our countries restrictions list for more information on how to register it. |
105 | EC_CONTENT_UNREGISTERED | Permanent; The content of the SMS is not allowed by the receiving mobile operator, this is usually caused by a lack of registration. Please consult our countries restrictions list for more information on how to register it. |
106 | EC_CAMPAIGN_VOLUME_EXCEEDED | Intermediate; The volume cap associated to the campaign of the SMS (via used originator) is reached at the receiving operator, and further SMS will be blocked until the volume cap resets. SMS to other operators are unaffected. You can find more information at our countries restrictions list. |
107 | EC_CAMPAIGN_THROUGHPUT_EXCEEDED | Intermediate; The maximum SMS rate associated to the campaign of the SMS (via used originator) is reached at the receiving operator, and excess SMS are being blocked. You can find more information at our countries restrictions list. |
110 | EC_MESSAGE_FILTERED | Permanent; The SMS originator or content is not allowed by the receiving mobile operator. Please consult our countries restrictions list for more information on applicable regulations and forbidden content or originators. |
The SMPP documentation describes everything you need to know about the MessageBird SMPP server. Keep in mind that it's important for you to already have a basic understanding of the SMPP protocol and to know how to set up your own SMPP client software.
MessageBird has multiple SMPP servers for you to connect to. Each SMPP server offers the ability to connect to it via the regular (plaintext) method, a TLS v1.2, or better connection.
Here is an overview of the available servers:
Hostname | Port | TLS port |
---|---|---|
smpp01.messagebird.com | 2775 | 2776 |
smpp02.messagebird.com | 2775 | 2776 |
smpp03.messagebird.com | 2775 | 2776 |
Your account manager at MessageBird will give you a username (system_id) and password. If you haven’t received them yet or you still need to make the request, simply send us an email to support@messagebird.com; we'll be happy to help you out.
Whenever an SMPP account has been set up for you, you’ll receive the maximum amount of binds and throughput. In most cases, these values will be something like 3 binds and 50 messages per second.
It might be interesting to note that these values are enforced on a per-server basis. That means that given the above example, you can set up 9 binds in total with a throughput of 150 messages per second when you connect to all servers.
Keep in mind that for maintenance purposes we only guarantee either that one server is up at any given time, so we advise you to connect to all of them.
MessageBird’s message relaying system is connection and server agnostic, so when you send an MT via a submit_sm PDU on connection A, you might receive the matching DLR in the form of a deliver_sm on connection B if both connections are bound with the same username.
This is even true for connections made to different servers, so this scenario is also possible if connection A is made to the smpp01 server and connection B to the smpp02 server.
If you connect to either server via a TLS connection, make sure to select TCP port 2776. Also be aware that the servers only accept an SSLv3 handshake method, so the old (legacy) SSLv2 handshake won’t work, even though your crypto stick plans to negotiate to use TLS1.0 or better.
The MessageBird SMPP servers support the following list of PDU types:
PDU name | command_id |
---|---|
bind_receiver | 0x00000001 |
bind_transceiver | 0x00000009 |
bind_transmitter | 0x00000002 |
deliver_sm_resp | 0x80000005 |
enquire_link | 0x00000015 |
generic_nack | 0x80000000 |
submit_sm | 0x00000004 |
unbind | 0x00000006 |
unbind_resp | 0x80000006 |
An SMPP bind_receiver, bind_transceiver, or bind_transmitter PDU request has a fixed set of fields. Most fields are irrelevant to us; actually, we only read the system_id, password, and interface_version fields and the rest is ignored.
Field name | Description |
---|---|
system_id | The username |
password | The password |
system_type | IGNORED |
interface_version | The SMPP protocol version you want to talk |
addr_ton | IGNORED |
addr_npi | IGNORED |
address_range | IGNORED |
The MessageBird SMPP server supports SMPP protocol version 3.3, 3.4, and 5.0. Keep in mind that if you set your SMPP client to talk version 3.3 you are missing out on some features, most notably TLV information in the deliver_sm PDUs you receive.
You can use the submit_sm PDU to send us your MT messages. Like a bind request, the submit_sm PDU request also has a couple of fields that are unused by our platform and can safely be ignored.
service_type | IGNORED |
source_addr_ton | Type of number for source_addr |
source_addr_npi | Numbering plan indicator for source_addr |
source_addr | Address of message origin |
dest_addr_ton | Type of number for destination_addr |
dest_addr_npi | Numbering plan indicator for destination_addr |
destination_addr | Address of message destination |
esm_class | Message mode and type |
protocol_id | IGNORED |
priority_flag | IGNORED |
schedule_delivery_time | IGNORED |
validity_period | The validity period of this message |
registered_delivery | The type if DLRs you want to receive |
replace_if_present_flag | IGNORED |
data_coding | The coding of the short_message field |
sm_default_msg_id | IGNORED |
sm_length | The length of short_message field |
short_message | The contents of the MT |
The values for the data_coding field are not solidly declared in the SMPP spec, so each SMPP server is more or less required to give its own definition. Below is a list of data codings that we accept as input. Keep in mind that only the values of 0, 2 and 8 are used as-is, other values will be converted to the most appropriate encoding out of 0, 2 and 8 to ensure acceptance of your messages by the operators.
Value | Encoding |
---|---|
0 | GSM7 |
1 | ASCII |
2 | 8BIT |
3 | ISO-8859-15 West European languages (Latin-9) |
6 | ISO-8859-5 Latin/Cyrillic |
7 | ISO-8859-8 Latin/Hebrew |
8 | UTF-16BE (UCS2) |
MOs and DLRs will be sent to you via a deliver_sm PDU. The fields are exactly the same as a submit_sm PDU, but there will be differences in which fields you are free to ignore, and which you are not.
Field | Name Description |
---|---|
service_type | IGNORED |
source_addr_ton | Type of number for source_addr |
source_addr_npi | Numbering plan indicator for source_addr |
source_addr | Address of message origin |
dest_addr_ton | Type of number for destination_addr |
dest_addr_npi | Numbering plan indicator for destination_addr |
destination_addr | Address of message destination |
esm_class | Message mode and type |
protocol_id | IGNORED |
priority_flag | IGNORED |
schedule_delivery_time | IGNORED |
validity_period | The validity period of this message |
registered_delivery | IGNORED |
replace_if_present_flag | IGNORED |
data_coding | The coding of the short_message field |
sm_default_msg_id | IGNORED |
sm_length | The length of short_message field |
short_message | The contents of the MT |
The values here are the same as in section submit_sm.
DLR messages which are sent to you as a deliver_sm may contain TLVs that you might be interested in. The following TLVs are supported as of the writing of this document:
Name | Tag ID | Description |
---|---|---|
receipted_message_id | 0x001E | The message_id referencing the same message_id that was returned in the submit_sm_resp of the MT (SMPP v5.0 spec: 4.8.4.47) |
message_state | 0x0427 | The final message state for a delivery receipt (SMPP v5.0 spec: 4.7.15 and 4.8.4.37) |
network_error_code | 0x0423 | The actual network error code (SMPP v5.0 spec: 4.8.4.42) |
network_mccmnc * | 0x1560 | Operator MCCMNC of recipient MSISDN of related SMS; given when available. |
TLVs marked with * are custom MessageBird SMPP tags.
In the case of MO messages, the short_message field will contain the contents of the message that was sent. In the case of DLR messages, it will contain report information in the following format:
The id parameter references the message_id that was returned in the submit_sm_resp of your submit_sm and it has the same value as the receipted_message_id TLV.
The state parameter references the message_state TLV, although the message_state contains a number pointing to a state where the state parameter in the short_message is described by a word.
The err parameter references error codes in section 3.3.4 and is the same as the network_error_code TLV.