Nothing shows up in the terminal after running node js script (twilio)

Viewed 101

I am trying to run a simple node js script for making a voice call using Twilio API. The problem is that when I type node app.js, nothing happens and it returns to the console. Like even if there is some kind of error, the error object should be printed into the console, right?

const accountSid = PROCESS.ENV.SID;
const authToken = PROCESS.ENV.AUTH;
const client = require('twilio')(accountSid, authToken);

client.calls
      .create({
         url: 'http://demo.twilio.com/docs/voice.xml',
         to: PROCESS.ENV.TO,
         from: PROCESS.ENV.FROM
       }), function(err, call){
           if(err){
               console.log(err);
           } else {
               console.log(call.sid)
           }
       }
1 Answers

Twilio developer evangelist here.

JavaScript is case-sensitive and PROCESS does not exist, instead you are looking for process. Try replacing all your calls to PROCESS.ENV with process.env and let me know if that helps.

Related