0

Here is my Twilio function:

exports.handler = function(context, event, callback) {

const twilioClient = context.getTwilioClient();

const to = event.to;
const from = event.from;


  twilioClient.calls
    .create({
      twiml: '<Response><Say>Ahoy, World!</Say></Response>',
      from: from,
      to: to,
      machineDetection: 'Enable',
    })
    .then((result) => {
      console.log('Call successfully placed');
      console.log(result.sid);
      return callback(null, 'success');
    })
    .catch((error) => {
      console.log(error);
      return callback(error);
    });
};

I'm trying to make a outbound call which says a message when one picks up. I'm getting the following error:

  "status_code": 500,
  "content_type": "text/plain",
  "body": "Error: Url parameter is required."

What I'm missing is if I send twiml do I need a url too?

jack
  • 330
  • 3
  • 12

1 Answers1

0

Based on your code snippet, it looks like you are using Twilio's Serverless Functions. By default, a new Service will use version 3.29.2 of the NodeJS twilio library. The ability to directly embed TwiML in the Call resource was first added in version 3.38.0. In order to fix the error, under "Settings & More" in the Services Console, select "Dependencies" and click "Edit" for the twilio library. The value can be updated to the latest version (as of today) which is 4.11.0. Once the dependency has been updated, you will need to run a "Deploy All" and then the code should work as expected.

Daniel O.
  • 583
  • 5
  • 15