API Docs

SMPP

Connect an existing SMPP client instead of using the HTTP API.

If your software or gateway already has an SMPP client, connect it to NBM SMS instead of writing an HTTP integration. SMPP messages use the same account, balance, prices and sender names as the HTTP API, and you can use both side by side.

Getting access

SMPP is self-service and free to enable. In the portal, open API → SMPP access:

  1. Create a login. Give it a label (e.g. "Billing system") and list the IP addresses your software connects from.
  2. Copy the system_id and password. The password is shown once; only a hash is stored. Lost it? Reset it to get a new one.
  3. Configure your client with the host, port, system_id and password, and bind.

Resellers and their customers each get their own SMPP section. A customer's messages are billed from their balance and can only use sender names assigned to them. SMPP logins are managed in the portal only — API keys can't create them.

You can switch a login off, reset its password, change its IP list or delete it at any time; open connections using it are closed immediately. NBM can suspend a login that is being abused, and only NBM can lift a suspension.

Connection settings

Settings
Host and porthost:portrequired
Shown in the portal next to your logins, normally smpp.nbmbrand.com:2776. Use exactly what the portal shows.
EncryptionTLSrequired
TLS 1.2 or newer. Plain connections are refused, because an SMPP bind sends the password unencrypted.
Bind typestringrequired
bind_transceiver, or a bind_transmitter plus a bind_receiver. You need a receiving bind to get delivery receipts.
system_idstringrequired
Generated by the portal; you can't choose it.
passwordstringrequired
Shown once when the login is created or reset. SMPP limits it to 8 characters.
system_typestringoptional
Ignored — leave empty.
interface_versionintegeroptional
SMPP 3.4 (0x34).

Static vs dynamic IP

Because SMPP passwords are short, each login only accepts connections from the IP addresses you list. That list is your main protection.

  • Connect from a fixed address — a server with a static or reserved IP, or behind a NAT gateway with one.
  • If your address changes, binds from the new one are refused with ESME_RBINDFAIL until you add it. Editing the list closes open connections, so change it at a quiet time.
  • Accepted: single public addresses, or ranges up to 256 addresses (IPv4 /24, IPv6 /48), at most 10 entries per login.
  • Address keeps changing? Use the HTTP API, which works from anywhere with an API key.

Sending a message

Send a normal submit_sm. It goes through the same checks as an HTTP send — sender name, balance, charging and queueing — and is billed in the same units.

submit_sm fields
source_addrstringrequired
One of your approved sender names (TON 5, NPI 0). Anything else gets ESME_RINVSRCADR.
destination_addrstringrequired
International (255712345678, TON 1, NPI 1) or local (0712345678).
short_message / message_payloadbytesrequired
The text. Put anything longer than one short_message in the message_payload TLV (up to 1600 characters). Don't split messages yourself.
data_codingintegeroptional
0/1 (ASCII), 3 (Latin-1) or 8 (UCS-2). Characters outside ASCII are removed before sending, as on the HTTP API.
registered_deliveryintegeroptional
Set bit 0 (1) to get a delivery receipt.
schedule_delivery_timestringoptional
Not supported: a submit that sets it is refused with ESME_RINVSCHED.
validity_periodstringoptional
Accepted and ignored.

The message_id in submit_sm_resp is the same id you see in the portal and in Get a message. Messages sent over SMPP are labelled SMPPin the portal's message report.

Delivery receipts

With registered_delivery = 1, you receive a deliver_sm (esm_class 0x04) when the message reaches a final state. Reply to each with deliver_sm_resp. The text uses the usual format, and the receipted_message_id and message_state TLVs are set too:

deliver_sm short_message
id:6b2f6e2a-4b0e-4e9a-9a2e-1a2b3c4d5e6f sub:001 dlvrd:001 submit date:2611201230 done date:2611201231 stat:DELIVRD err:000 text:Your NBM code is 4829
  • id is the message_id from submit_sm_resp.
  • stat is DELIVRD, UNDELIV, EXPIRED or REJECTD. Only final results are sent; times are UTC.
  • Unacknowledged receipts are resent with a growing delay. While you're disconnected they are kept for up to 72 hours and delivered when you bind again.
  • Your account webhook still fires for these messages if you've set one.

Error codes

Refusals come back as the command_status of bind_*_resp or submit_sm_resp.

StatusNameMeaning
0x0000000EESME_RINVPASWDBind refused: wrong password or unknown system_id (deliberately indistinguishable).
0x0000000DESME_RBINDFAILBind refused: address not on the list, login off or suspended, too many connections, or too many failed binds from this address in a minute.
0x00000004ESME_RINVBNDSTSSubmit on a receive-only bind.
0x0000000AESME_RINVSRCADRSender name unknown, not approved, disabled or not yours.
0x0000000BESME_RINVDSTADRNot a valid phone number.
0x00000001ESME_RINVMSGLENEmpty after removing non-ASCII characters, or too long.
0x00000043ESME_RINVESMCLASSA UDH-split message. Send one submit_sm with message_payload instead.
0x000000C1ESME_ROPTPARNOTALLWDA sar_* split parameter. Use message_payload instead.
0x00000061ESME_RINVSCHEDschedule_delivery_time was set; scheduling isn't supported over SMPP.
0x00000045ESME_RSUBMITFAILNot enough balance, or the account is disabled (SMPP has no 'out of credit' status).
0x00000058ESME_RTHROTTLEDOver the messages-per-second limit or window. Pause briefly and retry.
0x00000008ESME_RSYSERRA problem on our side. Try again later.

Limits & behaviour

LimitDefaultNotes
Connections per login2Extra binds are refused.
Messages per second10 per connectionOver it: ESME_RTHROTTLED.
Window10 per connectionSubmits sent but not yet answered. Wait for responses before sending more.
Logins per account3Create one per system that connects.
Keep-aliveevery 60 sSend enquire_link at least once a minute; silent connections close after 3 minutes.
  • Need higher limits? Ask support.
  • Your account must be active and verified. This is checked on every submit, so disabling the account stops a connected client immediately.
  • Not supported: scheduled delivery, split (UDH / sar_*) messages, and incoming (MO) messages.
  • If the connection drops, reconnect and bind again — receipts for messages sent meanwhile are waiting.

Code samples

These use the open-source smpplib (Python), smpp (Node.js) and onlinecity/php-smpp (PHP) packages. Option names can change between versions — check them against the version you install, and replace the host, credentials and sender name with your own.

Python (smpplib)
import re
import ssl
import smpplib.client

HOST, PORT = "smpp.nbmbrand.com", 2776          # exactly as shown in the portal
SYSTEM_ID, PASSWORD = "your-system-id", "your-pass"

client = smpplib.client.Client(HOST, PORT, ssl_context=ssl.create_default_context())

def on_submit_response(pdu):
    # keep this id to match the delivery receipt later
    print("accepted", pdu.message_id)

def on_receipt(pdu):
    text = pdu.short_message.decode("ascii", "replace")
    match = re.search(r"id:(\S+).*stat:(\w+)", text)
    if match:
        print("receipt", match.group(1), match.group(2))

client.set_message_sent_handler(on_submit_response)
client.set_message_received_handler(on_receipt)

client.connect()
client.bind_transceiver(system_id=SYSTEM_ID, password=PASSWORD)
client.send_message(
    source_addr_ton=5, source_addr_npi=0, source_addr="NBM",
    dest_addr_ton=1, dest_addr_npi=1, destination_addr="255712345678",
    short_message=b"Your NBM code is 482913",
    registered_delivery=True,
)
client.listen()  # blocks; receipts arrive in on_receipt
Node.js (smpp)
const smpp = require("smpp");

const session = smpp.connect({ url: "ssmpp://smpp.nbmbrand.com:2776" }, () => {
  session.bind_transceiver({ system_id: "your-system-id", password: "your-pass" }, (pdu) => {
    if (pdu.command_status !== 0) {
      console.error("bind refused", pdu.command_status);
      return;
    }
    session.submit_sm(
      {
        source_addr_ton: 5, source_addr_npi: 0, source_addr: "NBM",
        dest_addr_ton: 1, dest_addr_npi: 1, destination_addr: "255712345678",
        short_message: "Your NBM code is 482913",
        registered_delivery: 1,
      },
      (res) => {
        if (res.command_status === 0) console.log("accepted", res.message_id);
        else console.error("refused", res.command_status);
      }
    );
  });
});

session.on("deliver_sm", (pdu) => {
  session.send(pdu.response()); // always acknowledge receipts
  const text = pdu.short_message.message.toString();
  const match = text.match(/id:(\S+).*stat:(\w+)/);
  if (match) console.log("receipt", match[1], match[2]);
});

session.on("error", (err) => console.error(err));
PHP (onlinecity/php-smpp)
<?php
// composer require onlinecity/php-smpp
require __DIR__ . '/vendor/autoload.php';

use smpp\Address;
use smpp\Client as SmppClient;
use smpp\Smpp;
use smpp\transport\Socket;

// This library speaks plain TCP: connect it to a local TLS tunnel
// (stunnel) that forwards to smpp.nbmbrand.com:2776. See the note below.
$transport = new Socket(['127.0.0.1'], 2775);
$transport->setRecvTimeout(10000);
$smpp = new SmppClient($transport);

$transport->open();
$smpp->bindTransceiver('your-system-id', 'your-pass');

$from = new Address('NBM', Smpp::TON_ALPHANUMERIC);
$to   = new Address('255712345678', Smpp::TON_INTERNATIONAL, Smpp::NPI_E164);

$messageId = $smpp->sendSMS($from, $to, 'Your NBM code is 482913', null, Smpp::DATA_CODING_DEFAULT);
echo 'accepted: ' . $messageId . PHP_EOL;

$smpp->close();
stunnel config
; /etc/stunnel/nbm-smpp.conf
[nbm-smpp]
client = yes
accept = 127.0.0.1:2775
connect = smpp.nbmbrand.com:2776
verifyChain = yes
CApath = /etc/ssl/certs
checkHost = smpp.nbmbrand.com