Created
January 6, 2017 11:26
-
-
Save gregory-yet/205ee9f0bfa907f9e595fb75663c9ac8 to your computer and use it in GitHub Desktop.
Send message with Gammu and Node.js
This file contains 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
// replace /etc/gammu-smsdrc with your config file | |
// replace 06xxxxxxxx with your phone number | |
// replace Bip bip with your message | |
var spawn = require('child_process').spawn; | |
var retour = []; | |
var gammu = spawn(`gammu`, [`-c`, '/etc/gammu-smsdrc', `sendsms`, 'TEXT', '06xxxxxxxx', '-text', 'Bip bip']); | |
gammu.stdout.on('data', function(data){ | |
retour.push(data.toString('ascii')); | |
}); | |
gammu.stderr.on('data', function(err){ | |
retour.push(err.toString('ascii')); | |
}); | |
gammu.on('close', function(){ | |
console.log('Gammu finished'); | |
console.log(retour.join(' - ')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment