Dhanushka Sampath
Dhanushka Sampath

Reputation: 255

how to bind a custom request body to twilio <redirect>

I want to pass the data to another method in my java code using twilio redirect tag. I want to know how my data(assume a string) can be bind to the post request made by redirect tag

Redirect redirect = new Redirect.Builder("https://dcebfc49.ngrok.io/asr/smsToTeaLady").method(HttpMethod.POST).build(); 

when examine the POST request body made by redirect, I found that it looks like this.

Called=%2B94702470749&ToState=&CallerCountry=US&Direction=outbound-api&CallerState=WA&ToZip=&CallSid=CA70cc8a1f3442eb73801ed65e74b41ff3&To=%2B94702470749&CallerZip=98503&ToCountry=LK&ApiVersion=2010-04-01&CalledZip=&CalledCity=&CallStatus=in-progress&From=%2B12064389402&AccountSid=ACdb1e25e9b79857718595c721d5d5e00f&CalledCountry=LK&CallerCity=SEATTLE&Caller=%2B12064389402&FromCountry=US&ToCity=&FromCity=SEATTLE&CalledState=&FromZip=98503&FromState=WA

So my intent is embedding my custom data into this request.

Could any one please help me.Thank you!

Upvotes: 0

Views: 125

Answers (1)

Dhanushka Sampath
Dhanushka Sampath

Reputation: 255

I found the answer. We can bind more data to post request as like this.

https://dcebfc49.ngrok.io/asr/smsToTeaLady?tea=3&coffee=5&planty=4

Upvotes: 1

Related Questions