Created
December 17, 2016 14:21
-
-
Save itswadesh/838e4ea2b6f841d313ecc8e05ce6d1b2 to your computer and use it in GitHub Desktop.
Send sms using NodeJS from India (https://www.textlocal.in/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var urlencode = require('urlencode'); | |
var msg = urlencode('hello js'); | |
var toNumber = 'TO_PHONE_NO'; | |
var username = 'TEXTLOCAL_USER_EMAIL'; | |
var hash = 'TEXTLOCAL_USER_HASH'; // The hash key could be found under Help->All Documentation->Your hash key. Alternatively you can use your Textlocal password in plain text. | |
var sender = 'txtlcl'; | |
var data = 'username=' + username + '&hash=' + hash + '&sender=' + sender + '&numbers=' + toNumber + '&message=' + msg; | |
var options = { | |
host: 'api.textlocal.in', path: '/send?' + data | |
}; | |
callback = function (response) { | |
var str = '';//another chunk of data has been recieved, so append it to `str` | |
response.on('data', function (chunk) { | |
str += chunk; | |
});//the whole response has been recieved, so we just print it out here | |
response.on('end', function () { | |
console.log(str); | |
}); | |
}//console.log('hello js')) | |
http.request(options, callback).end();//url encode instalation need to use $ npm install urlencode |
Hi Any one tried this? Does this work? so how do you use it?
A big thank you, really worked well
cout<<"WOW works like a charm. \n THNX"
It's working fine.. but I can't return a response.
Thanks its working ,also you need to pass exact message template as template created on gateway.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sir in laravel i used your code but i didnot get the message. please give the solution