Skip to content

Smpp

Activation

To enable the SMPP server feature, please contact the admin by sending an email to [email protected]. Once your request is approved,your smpp credentials will be sent to your email and the SMPP menu will appear in your profile

smpp-user-credential

Connect to server

Bind

In SMPP (Short Message Peer-to-Peer) protocol, a bind is the process by which an SMPP client (ESME - External Short Messaging Entity) establishes a session with an SMPP server (SMSC - Short Message Service Center) to send or receive SMS messages. There are three main types of SMPP bind, each serving different communication needs:

Transmitter (TX) : The Transmitter bind is used when the ESME needs to send SMS messages only. This bind type is suitable for applications that exclusively push outbound SMS notifications, such as alerts or promotional messages. The connection allows submission of messages to the SMSC, but it cannot receive incoming messages.

Receiver (RX) : The Receiver bind is utilized when the ESME is intended to receive SMS messages from the SMSC. This type of bind is typically used in systems that handle incoming messages, such as when receiving user replies, MO (Mobile Originated) messages, or system notifications.

Transceiver (TRX) : The Transceiver bind combines the capabilities of both transmitter and receiver in a single connection. It enables the ESME to send and receive messages over one session, making it highly efficient for applications requiring two-way communication. This is ideal for modern messaging services, as it simplifies the connection management.

Example Code To Bind Connection

js
var smpp = require("smpp");

const serverUrl = "smpp server url";
const user = "your username"; // from credential email
const password = "your password"; // from credential email

var session = smpp.connect(
  {
    url: serverUrl,
    debug: false,
  },
  function () {
    session.bind_transceiver(
      {
        system_id: user,
        password: password,
      },
      function (pdu) {
        console.log("PDU Reponse : ", pdu);
      }
    );
  }
);

session.on("enquire_link", (pdu) => {
  session.send(pdu.response());
});

Send Message

To send an SMS using the submit_sm command in SMPP, you first need to ensure that your SMPP client is connected and bound to the SMSC as either a Transmitter or Transceiver. Once connected, the client can submit SMS messages by preparing a submit_sm PDU (Protocol Data Unit) with the necessary parameters.

The submit_sm command includes key fields such as the sender's address (source_addr), the recipient's phone number (destination_addr), and the message content (short_message). Additional parameters like data_coding control the message encoding, with options such as default encoding (for plain text) or Unicode (for special characters or non-Latin scripts).

After sending the submit_sm command to the SMSC, the client receives a submit_sm_resp response that contains a status code (command_status). A successful submission is indicated by command_status = 0x00000000. The response also includes a message_id, which can be used to track the status of the message, including any delivery receipts, if requested.

In summary, the submit_sm command allows an SMPP client to efficiently send SMS messages by defining the necessary parameters, sending the PDU to the SMSC, and receiving a response that confirms whether the message was successfully accepted for delivery.

Example Code To Send Message

js
--- previous bind code ---

const source = "" // your source number
const destination = "" // your target number

session.submit_sm({
  source_addr: source,
  destination_addr: destination,
  short_message: "Hello! this is smpp message",
},

function (pdu) {
  if (pdu.command_status === 0) {
    console.log(pdu.message_id); // send message id
  }
});

Receive Message

To handle receiving messages in SMPP, your client must be bound to the SMSC as a Receiver or Transceiver. There are two primary types of messages you may receive: Delivery Receipts (DLR) and Mobile Originated (MO) messages. you can listen deliver_sm for receive and handle message.

Example Listen deliver_sm Code

js
--- previous bind code ---

session.on("deliver_sm", (pdu) => {
  // handle logic
});

Receiving Delivery Report (DLR)

A Delivery Report (DLR) is report that contain the final status of an SMS that was previously submitted. This could indicate successful delivery to the recipient, failure, or a message in transit.

Connection Setup

Ensure the client is bound as a Receiver or Transceiver. The client must be set up to listen for incoming PDUs (deliver_sm PDU), which will carry the DLR.

Handle deliver_sm for DLR

The deliver_sm PDU contains the delivery receipt details.

Example PDU For Dlr

json
{
  "command_length": 123,
  "command_id": 5,
  "command_status": 0,
  "command": "deliver_sm",
  "short_message": {
    "message": "id:670df2ee851e71bb6a7c2ads submit date:1728967406738 done date:1728967412772 stat:DELIVRD"
  }
}

Sms Status

SMPP StatusDescription
ENROUTEMessage has been accepted and is en route to the recipient.
DELIVRDMessage has been successfully delivered to the recipient.
EXPIREDMessage has expired without being delivered.
DELETEDMessage has been deleted and will not be delivered.
REJECTDMessage has been rejected by the SMSC.
STATERRMessage failed due to a system or status error.

MO

Mobile Originated (MO) messages are messages sent from a mobile device to the SMSC, which then forwards them to your SMPP client. These are typically replies or inbound SMS traffic. Connection Setup

The client must be bound as a Receiver or Transceiver to receive incoming messages. MO messages also come in the form of the deliver_sm PDU.

Handle deliver_sm for MO When receiving an MO message, the deliver_sm PDU will contain the actual message content sent by the mobile device. The important fields include:

source_addr: The phone number of the sender (the mobile device).
destination_addr: The phone number or shortcode to which the message was sent.
short_message: The message content (text of the SMS).

Example PDU For MO

json
{
  "command_status": 0,
  "command": "deliver_sm",
  "source_addr": "61421113053",
  "destination_addr": "61481076483",
  "short_message": { "message": "Reply Message" }
}

Response Code

for information about response code, visit at list error status