SMPP API
API Information
This protocol defines the SMPP communication protocol for the EngageLab OTP service and is designed to enable efficient and reliable message delivery and status reporting over TCP connections. The API information includes the IP address, port number, and authentication details required for the connection. Please ensure that the account and password provided through authorized channels are configured correctly.
SMPP Address
SMPP address: otpsmpp.api.engagelab.cc
Please obtain the following information through an authorized channel, such as business or technical support:
- Port:
{ port } - Account:
{ system_id } - Password:
{ password }
Establishing a Connection
Client Packet
After establishing the TCP connection, the first packet must send the BindTransceiver command (0x00000009) for authentication. This packet must include the following fields:
- system_id: The system account assigned to the client, used to identify the client.
- password: The access password corresponding to the system account, used for authentication.
Server Response
Successful Response
- The server returns the
BindTransceiverRespcommand (0x80000009). - The
system_idfield is populated with the same value as the receivedsystem_idfield.
Failed Response
- If authentication fails, the server disconnects the TCP connection and records the reason for the failure.
Message Sending
Server Logic
Message sending uses the SUBMIT_SM command (0x00000004) to submit a message delivery request. The server logic is as follows:
- The server parses the request content and always uses the SMS channel for delivery.
- Message delivery is synchronous, and the result is returned through the
SUBMIT_SM_RESPcommand (0x80000004). - Delivery status is reported through delivery reports. For details, see Delivery Reports.
- It is recommended to use
UCS2encoding to support special characters and internationalization.
Client Packet
The client sends the SUBMIT_SM command (0x00000004) to submit a message. The packet must include the following fields:
service_type
- Value:
MSG/CODE/MRKT - Default value:
MSG
- Value:
source_addr
- Can be left empty and is currently not used in OTP.
destination_addr
- The message destination, which must be in international mobile number format (for example,
+8613800138000).
- The message destination, which must be in international mobile number format (for example,
short_message
- The message content uses JSON format, as shown below:{ "id": "xxx", // Template ID "language": "default", // Language used; default is default "code": "xx", // Verification code; used only when service_type is CODE "params": { // Custom key-value pairs "key1": "val1" // val must be in string format } }
{ "id": "xxx", // Template ID "language": "default", // Language used; default is default "code": "xx", // Verification code; used only when service_type is CODE "params": { // Custom key-value pairs "key1": "val1" // val must be in string format } }This code block in the floating window
- The message content uses JSON format, as shown below:
data_coding
- It is recommended to use
UCS2encoding to ensure special characters such as{}are parsed correctly. - If direct transmission of
{}is supported, the default encoding may be used (0x00).
- It is recommended to use
status in the header
- Set to
0x00000000.
- Set to
Server Response
The server sends the SUBMIT_SM_RESP command (0x80000004) in response to the message delivery result.
Successful Response
- Value of the status field in the header:
0x00000000 - MESSAGE_ID field: The response message ID, used to correlate delivery reports.
Failed Response
- The server populates the status field in the header to indicate the reason for failure:
| Status Code | Description | Value |
|---|---|---|
ESME_RINVPARAM |
Invalid parameter. Please check the request content format. | 0x00000032 |
ESME_RSYSERR |
Internal service error. It is recommended to try again later. | 0x00000008 |
ESME_RSUBMITFAIL |
Delivery failed, possibly due to a template issue or other reasons. | 0x00000045 |
ESME_RINVNUMMSGS |
Incorrect content format in the short_message field. |
0x00000055 |
ESME_RUNKNOWNERR |
Unknown error. Please contact technical support. | 0x000000FF |
Delivery Reports
The server reports delivery status through the DELIVER_SM command (0x00000005). The relevant fields are as follows:
service_type
- Fixed value:
MSG
- Fixed value:
source_addr
- Leave empty.
destination_addr
- Same as the
destination_addrin theSUBMIT_SMcommand.
- Same as the
data_coding
- Encoding method: default value
0x00.
- Encoding method: default value
esm_class
- Set to
0x00.
- Set to
short_message
- The delivery report is packaged using the
delivery receiptformat.
- The delivery report is packaged using the
ReceiptedMessageID in TLV
- Message ID, used for correlation and identification.
MessageState in TLV
- Message status, field value
0x0427.
- Message status, field value
Status Parsing
In the short_message field, the meanings of the stat values are as follows:
| Status | Meaning |
|---|---|
DELIVRD |
Delivered successfully |
UNDELIV |
Delivery failed |
Other Notes
Invalid Commands
For invalid commands submitted by the client, the server returns the GENERIC_NACK command (0x80000000) and records the relevant logs. The server supports only the following commands:
EnquireLinkcommand (0x00000015)Unbindcommand (0x00000006)SubmitSMcommand (0x00000004)DeliverSMRespcommand (0x80000005)BindTransceivercommand (0x00000009)
Keepalive
The client must send the EnquireLink command (0x00000015) once every 30 seconds (tolerance: ±5 seconds) to ensure the connection remains active.
Meaning of Sending Status
| Status Code | Meaning |
|---|---|
ESME_RINVPARAM |
Invalid parameter. Please check the request content format. |
ESME_RINVNUMMSGS |
Incorrect content format in the short_message field. |
ESME_RSUBMITFAIL |
Delivery failed, possibly due to a template issue or other reasons. |
ESME_RSYSERR |
Internal service error. It is recommended to try again later. |
ESME_RUNKNOWNERR |
Unknown error. Please contact technical support. |
DELIVRD |
Message delivered successfully |
UNDELIV |
Message could not be delivered |
Terminology
- SMPP: Short Message Peer-to-Peer Protocol, used for message exchange with SMS gateways.
- SUBMIT_SM: The SMPP command for submitting SMS messages.
- DELIVER_SM: The SMPP command used by the server to report message delivery status.
If you have any questions, please contact OTP Technical Support.
