How to Send request body in Redirect twilio

Viewed 157

How to pass request body in Twilio redirect? since there is a limit for the header length and need to send huge data one function to another function.

const VoiceResponse = require('twilio').twiml.VoiceResponse;


const response = new VoiceResponse();
response.redirect({
    method: 'POST'
}, 'http://pigeons.com/twiml.xml');

console.log(response.toString());
1 Answers

Twilio developer evangelist here.

When using TwiML <Redirect> you cannot affect what is sent in the request body to the next URL. If you want to pass information to the next URL you can add query string parameters to the URL. You can also set cookies on the TwiML response which will be sent back to your server with the next request.

If you have data that is too big for you to send in either of those formats, then you might want to store it on your server side in a database and then send the ID of the record over query string parameters or cookies, so that you can use the ID to retrieve the data in the next request.

Related