Skip to content

Instantly share code, notes, and snippets.

@gregory-yet
Created January 6, 2017 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gregory-yet/205ee9f0bfa907f9e595fb75663c9ac8 to your computer and use it in GitHub Desktop.
Save gregory-yet/205ee9f0bfa907f9e595fb75663c9ac8 to your computer and use it in GitHub Desktop.
Send message with Gammu and Node.js
// 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