Conference Campaign Solo Rich Messaging

Tutorial section - SMS

Send SMS with SMPP using NodeJS

Sending SMS with the SMPP API using the NodeJS programming language

The node-smpp library can be used to make SMPP requests using Node.js. This library can be used to submit SMS to an SMS gateway or SMSC.

SMPP requirements and resources

SMPP is the Short Message Peer-to-Peer protocol for conveying SMS operations. An SMPP account can easily be obtained for using the Tyr SMS Gateway or SMSC Simulator. The following are required to send SMS with SMPP:

  • SMPP API account - SMPP API account for the Melrose Labs Tyr SMS Gateway
  • SMPP API account (simulator) - SMPP API account for the Melrose Labs SMSC Simulator. Allows you to simulate inbound and outbound SMS delivery using an SMPP API account with your application.
  • SMPP Protocol [reference] - Short Message Peer-to-Peer Protocol v3.3, v3.4 and v5 specifications and guides

NodeJS requirements and resources

Node.js is a scripting/programming language and can be used to quickly and easily add SMS support for programmatically sending and receiving SMS messages. Use it for transactional messaging and notifications between your application and mobiles. The following are required to send SMS using NodeJS:

  • Node.js - Node.js is a scripting/programming language

Requirements and resources

The following are required to send SMS with SMPP using NodeJS:

  • node-smpp - SMPP client and server implementation in Node.js.


Create the file sendsms.js containing the code below. Replace the hostname, port 2775, SYSTEMID and PASSWORD values with those from your SMPP API account. Alternatively, replace SYSTEMID and PASSWORD with those allocated to you for use with the Melrose Labs SMSC Simulator.

The following example Node.js code opens an SMPP transmitter bind to on port 2775 (SMPP port), and then sends the message Hello World #$£ to mobile number 447712345678 from MelroseLabs. The message ID returned in $messageID is that returned from the SMS gateway or SMSC after a successful submission. The SMPP system ID and password for the SMPP account are contained in SYSTEMID and PASSWORD respectively.

	var smpp = require('smpp');
var session = smpp.connect('smpp://');
	system_id: 'SYSTEMID',
	password: 'PASSWORD'
}, function(pdu) {
	if (pdu.command_status == 0) {
		// Successfully bound
			destination_addr: '447712345678',
			short_message: 'Hello World €$£'
		}, function(pdu) {
			if (pdu.command_status == 0) {
				// Message successfully sent

Other APIs covered in our tutorials that can be used for sending and receiving SMS using NodeJS include: REST

Whatever the language or API, you can send SMS and receive SMS between applications and mobiles for a wide range of uses with a number of our services. Please consider using our Messaging, SMS gateway and Bulk SMS solutions. If you are interested in testing your application's SMS support and are using the SMPP protocol, then we recommend that you take a look at the Melrose Labs SMSC Simulator service that can simulate SMS message delivery to and from mobiles. The SMSC Simulator supports SMPP v3.3, v3.4 and v5, and has a high degree of SMPP protocol conformance. Later in 2020 we will be providing access to the Melrose Labs Tyr SMS Gateway for A2P, P2A, bulk, wholesale and business SMS, and for text marketing and other applications. The Melrose Labs Tyr SMS Gateway will support REST and SMPP APIs.

Follow us on LinkedIn for updates on Melrose Labs services and news. Follow Us