Los Angeles, CA

Send text using Javascript

Send text using Javascript

/*
for demo and quick start place this code in your app.js or server.js
please run 'npm install puretext --save' in terminal
*/

  const puretext = require('puretext');
  require('request');

  let text = {
      // To Number is the number you will be sending the text to.
      toNumber: '+X-XXX-XXX-XXXX',
      // From number is the number you will buy from your admin dashboard
      fromNumber: '+14703497270',
      // Text Content
      smsBody: 'Sending SMS using Node.js',
      //Sign up for an account to get an API Token
      apiToken: 'pkdcar'
  };

  puretext.send(text, function (err, response) {
    if(err) console.log(err);
    else console.log(response)
  })
Facebook Comments