Send SMS Text Messages From Node.js (Routemobile)
1 min readNov 22, 2020
In this tutorial, we’ll show you how to use Routemobile’s Programmable SMS to send SMS from your Node.js application.
Prerequisites
Before you begin, make sure you have:
- Node.js installed on your machine
Sign up for (or log in to) your Routemobile’s account. (https://www.routemobile.com/)
After that make one file sms.js. Put the following code to it.
var http = require('http');
let test_message = "My test sms.";
let username = "xxxxxxxxxx";
let password = "xxxxxxxxxx";
let phone_number = "900xxxxxxx";
let sender_id = "xxxxxxxx";let url = 'http://sms6.rmlconnect.net:8080/bulksms/bulksms?username='+username+'&password='+password+'&type=0&dlr=1&destination='+phone_number+'&source='+sender_id+'&message='+test_message;
http.get(url, function (result) {
console.log('send sms Success, with: ' + result.statusCode);
}).on('error', function (err) {
console.log('send sms Error, with: ' + err.message);
});
Go to terminal and run
node sms