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:
- Create a login. Give it a label (e.g. "Billing system") and list the IP addresses your software connects from.
- Copy the
system_idand password. The password is shown once; only a hash is stored. Lost it? Reset it to get a new one. - Configure your client with the host, port,
system_idand 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
Host and porthost:portrequiredsmpp.nbmbrand.com:2776. Use exactly what the portal shows.EncryptionTLSrequiredBind typestringrequiredbind_transceiver, or a bind_transmitter plus a bind_receiver. You need a receiving bind to get delivery receipts.system_idstringrequiredpasswordstringrequiredsystem_typestringoptionalinterface_versionintegeroptional0x34).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_RBINDFAILuntil 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.
source_addrstringrequiredESME_RINVSRCADR.destination_addrstringrequired255712345678, TON 1, NPI 1) or local (0712345678).short_message / message_payloadbytesrequiredshort_message in the message_payload TLV (up to 1600 characters). Don't split messages yourself.data_codingintegeroptional0/1 (ASCII), 3 (Latin-1) or 8 (UCS-2). Characters outside ASCII are removed before sending, as on the HTTP API.registered_deliveryintegeroptional1) to get a delivery receipt.schedule_delivery_timestringoptionalESME_RINVSCHED.validity_periodstringoptionalThe 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:
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 4829idis themessage_idfromsubmit_sm_resp.statisDELIVRD,UNDELIV,EXPIREDorREJECTD. 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.
| Status | Name | Meaning |
|---|---|---|
0x0000000E | ESME_RINVPASWD | Bind refused: wrong password or unknown system_id (deliberately indistinguishable). |
0x0000000D | ESME_RBINDFAIL | Bind refused: address not on the list, login off or suspended, too many connections, or too many failed binds from this address in a minute. |
0x00000004 | ESME_RINVBNDSTS | Submit on a receive-only bind. |
0x0000000A | ESME_RINVSRCADR | Sender name unknown, not approved, disabled or not yours. |
0x0000000B | ESME_RINVDSTADR | Not a valid phone number. |
0x00000001 | ESME_RINVMSGLEN | Empty after removing non-ASCII characters, or too long. |
0x00000043 | ESME_RINVESMCLASS | A UDH-split message. Send one submit_sm with message_payload instead. |
0x000000C1 | ESME_ROPTPARNOTALLWD | A sar_* split parameter. Use message_payload instead. |
0x00000061 | ESME_RINVSCHED | schedule_delivery_time was set; scheduling isn't supported over SMPP. |
0x00000045 | ESME_RSUBMITFAIL | Not enough balance, or the account is disabled (SMPP has no 'out of credit' status). |
0x00000058 | ESME_RTHROTTLED | Over the messages-per-second limit or window. Pause briefly and retry. |
0x00000008 | ESME_RSYSERR | A problem on our side. Try again later. |
Limits & behaviour
| Limit | Default | Notes |
|---|---|---|
| Connections per login | 2 | Extra binds are refused. |
| Messages per second | 10 per connection | Over it: ESME_RTHROTTLED. |
| Window | 10 per connection | Submits sent but not yet answered. Wait for responses before sending more. |
| Logins per account | 3 | Create one per system that connects. |
| Keep-alive | every 60 s | Send 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.
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_receiptconst 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
// 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();; /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