Skip to content

Instantly share code, notes, and snippets.

Created April 12, 2017 23:25
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ThomasG77/8790e35ad5a220d3d327e201a3f27580 to your computer and use it in GitHub Desktop.
Essai d'envoi de SMS uniquement avec Node et un abonnement (adaptée à 90% de
const https = require('https');
const querystring = require('querystring');
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
function sendSms (message) {
var qs = querystring.stringify({
user: process.env.free_fr_user_account,
pass: process.env.free_fr_sms_key,
msg: message
var apiUrl = '' + '?' + qs;
https.get(apiUrl, function (res) {
if (res.statusCode !== 200) {
// You can use alternate option here (mail,...)
console.log('Not 200', res);
}).on('error', function (e) {
if (!process.env.free_fr_user_account && !process.env.free_fr_sms_key) {
console.log('You need to set both environment variables');
} else {
sendSms("Il était un petit navire Il était un petit navire Qui n'avait ja-ja-jamais navigué Qui n'avait ja-ja-jamais navigué Ohé, ohé…");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment