I am trying to work with Twilio autopilot which trigger the twilio function after gathering some words, I need program to play digits or 'DTMF tone'
I have written code in javascript in Twilio Function as
exports.handler = function(context, event, callback) {
const VoiceResponse = require('twilio').twiml.VoiceResponse;
const response = new VoiceResponse();
response.play({
digits: '3'
});
console.log(response.toString());
callback(null, response);
};
as this code the Twilio function generates the XML (TwiML) file, but if triggered by an autopilot it shows following error
Invalid Autopilot Actions JSON: Invalid Autopilot Action Possible Causes Actions JSON does not comply with the Actions Schema (https://carnelian-neanderthal-8008.twil.io/assets/ActionsSchema.json)
Possible Solutions Test your JSON response against the Actions Schema (https://carnelian-neanderthal-8008.twil.io/assets/ActionsSchema.json)
By this error I am guessing autopilot needs only .json for execution. Should I try any other way.
Any suggestions?