I have a lambda function that generates some text. This is for a simple Twilio app
<Say>Welcome to your conference room!</Say>
<Dial>
<Conference beep="true">waitingRoom</Conference>
</Dial>
When I make a POST request using postman it outputs exactly that. but I have two problems:
I know it has to do something with the incoming params mapping and also mapping the response from Lambda back to the API Gateway as text/xml. But I can;t figure out how to do this.
I used the following template mapping to basically just strip the quotes and it worked:
I am glad not to be the only one struggling with AWS Api Gateway :)
As far as I know, AWS Api Gateway is mostly JSON oriented. If you can change the content of the response returned (using JSON), maybe you could resolve your problem :
{"say": "Welcome to your conference room!",
"dial": [{
"conference": [{
"beep": "true",
"name": "waitingRoom"
}]
}
]}
You could then map this content using the mapping template feature (in the Integration response screen), by adding a template with a content-type set to "application/json", and a mapping-template set to :
<Say>$input.json('say')</Say>
<Dial>
<Conference beep="$input.json('dial.conference.beep')">$input.json('dial.conference.name')</Conference>
</Dial>
Does this help you or I am missing something ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With