title: How do I call 3rd party HTTP APIs inside twilio function?
body: <p>I am trying to call my nodejs API inside Twilio function but it's not working. below is my code </p>
  
  <pre><code>var got = require('got');
  var requestPayload = {foo: 'bar'};
  
  got.post('https://your-api.com/endpoint', 
        { body: JSON.stringify(requestPayload), 
          headers: { 
          'accept': 'application/json' 
          }, 
         json: true
       }).then(function(response) {
       console.log(response.body)
       callback(null, response.body);
     }).catch(function(error) {
     callback(error)
   });
  </code></pre>