Sending SMS using the SMPP protocol
The open protocol SMPP allows technicians and companies to integrate their applications with the SMS messaging platform of LabsMobile using a widely adopted standard in telecommunications. This protocol is used for the exchange of SMS messages between short message service centers (SMSC) and external sending applications.
The functionalities through the SMPP protocol are:
- Sending Standard SMS
- Sending Unicode SMS
- Sending Concatenated SMS
- Receive the status of each SMS (DLR)
This documentation explains in detail the integration and automation process of these functionalities.
To start an integration with sending via the SMPP protocol, the following requirements are essential:
- A LabsMobile account associated with a username (registration email). Create an account here.
- It is necessary to activate the SMPP service.
- The account must have available balance to allow message sending.
To take into account
This documentation corresponds to SMPP protocol version 3.4.
We recommend the use of our API http/POST.
Activation of the SMPP Service
To activate this service, you must complete the following SMPP service registration form with the following information:
- Username associated with the account.
- If the account and first purchase have been validated.
- IP address of the client that will make the SMPP connections.
- Estimated monthly volume of messages.
SMPP connection credentials will be created within a maximum of 72 hours and communicated via email.
Request SMPP service registrationParameters of connection
The following data is necessary to establish an SMPP connection and allow the sending of SMS messages. Below are the values and the function of each of the required parameters.
system_id | User identifier assigned for SMPP authentication | B000123456 |
password | Password associated with the system_id | Kz234d&5 |
host | IP or domain of the SMPP server | smpp.labsmobile.com |
port | Port TCP to establish the connection | 2775 |
bind_type | Defines what operations the client can perform. | bind_transceiver |
Recommendation Make sure that the provided IP is correctly configured to establish outgoing connections to the SMPP server. In addition, we recommend using a static IP and a dedicated server to ensure the stability and security of the connection.
Recommendation We recommend activating Automatic Top-ups so that there are always available credits in the account and the SMS sending service is not interrupted.
PDU SMPP compatible
The SMPP server supports the following PDU, fundamental for establishing and maintaining communication between the client and the server. Below are detailed their main functions and how they intervene in the transmission and reception of SMS messages.
- Expand all
Types of PDU
The SMPP server supports the following PDU
bind_transmitter
It is a request to establish an SMPP session as a transmitter. The client sends this command to the SMSC (server) to authenticate and send outgoing SMS messages.
unbind
It is used to close an SMPP session correctly. Indicating that it no longer needs to keep the connection active.
submit_sm
It is responsible for sending an SMS message through an active session.
deliver_sm
It is the command that the SMSC uses to confirm the delivery status of the message (DLR).
enquire_link
It serves as a
ping
maintenance to check that the connectionTCP
is still active between the client and the server.
The PDUs can return the following statuses:
ESME_ROK | Indicates that the operation was accepted correctly. |
ESME_RUNKNOWNERR | Generic error code indicating an unknown error on the SMPP server or lack of balance in the account. |
Sending SMS (submit_sm)
The submit_sm
command is the main method for sending SMS messages via SMPP. This section details the key parameters that must be included in each request to ensure the correct sending of the message.
- Expand all
PARAMETERS
The parameters or data are sent when an SMPP connection is made. Below are the values and functionality of all the parameters.
source_addr_ton integer mandatory
It is recommended to use the value
5
for alphanumeric senders,3
for shortcode senders, and0
or1
for international numbers.Example:
"source_addr_ton":5
source_addr_npi integer mandatory
Normally the value
0
is used for senders of type shortcode or alphanumeric. If the sender is an international number, the value1
should be used.Example:
"source_addr_npi":0
source_addr string mandatory
It can be a shortcode number, an international number, or an alphanumeric text, depending on the values configured in
TON
andNPI
. It should be noted that the sender depends on the destination country. For more information, you can validate the following documentation.Example:
"source_addr":"LABSMOBILE"
dest_addr_ton integer mandatory
Must be set to
1
to indicate that the number is international.Example:
"dest_addr_ton":1
dest_addr_npi integer mandatory
Must be set to
1
to use the international format E.164 .Example:
"dest_addr_npi":1
destination_addr string mandatory
It should be indicated that the number is international using the appropriate values in
TON
andNPI
, and the number must follow the international format E.164 .Example:
"destination_addr":"573124868812"
short_message string mandatory
Text of the SMS message to be sent. The maximum length depends on the encoding used
data_coding
.If standard SMS are sent, only the characters of the GSM 3.38 7bit alphabet are valid. Concatenated SMS and Unicode SMS can also be sent.
Example:
"short_message":"Hello world!"
data_coding integer mandatory
Defines the type of message encoding. Affects the number of characters and the type of symbols allowed.
Use value
0
(SMSC) or1
(IA5_ASCII) for standard messages. Use8
(UCS2) if the message contains special characters.Example:
"data_coding":8
{ "cmdName":"submit_sm", "params":{ "source_addr_ton":3, "source_addr_npi":0 "source_addr":"LABSMOBILE", "dest_addr_ton":1 "dest_addr_npi":1 "destination_addr":"573124868812", "short_message":"Hello world!", "registered_delivery":1, "data_coding":1, "sm_length":8 }, "seqNr":2, "cmdStatus":"ESME_ROK" }
Important The code ESME_ROK
indicates that the request was accepted, but does not imply that the message was delivered to the user's device. A DLR or PDU object should be awaited to know the final delivery status.
Recommendation In case of receiving ESME_RUNKNOWNERR
, check that your account has available balance to make shipments. Also, make sure that the destination phone number and the message content are specified correctly.
Delivery confirmations (deliver_sm)
The delivery statuses are included in the short_message
field within the deliver_sm
PDU, which contains information about the result of sending each message.
Typical format: id:XXXXXXXXXX submit date:YYMMDDHHMM done date:YYMMDD
id
: Identifier of the sent message.submit date
: Date and time of sending inYYMMDDHHMM
format.done date
: Date and time when the delivery attempt was completed inYYMMDDHHMM
format.stat
: Final status of the message (for example:DELIVRD
,UNDELIV
, etc.).err
: Numeric error code, present if the message was not delivered correctly.
Example: short_message: "id:681ca29a4caec submit date:2505081
Below is a description of each of the delivery statuses:
DELIVRD | Indicates that the message was successfully delivered to the recipient's device. |
UNDELIV | Not possible to deliver the message, usually because the number is incorrect. |
REJECTD | Message rejected by some operator policy or by the mobile device. |
Support resources
We recommend that you consult and take into account the following support resources in your integration: