Am trying to Create a SMS bot using help of Twilio, Aws API gateway and AWS lambda.
I ve setup the twilio phone number, AWS API for and lambda. I configured twilio to call my API for every sms i send.
I can see that twilio calling my API Gateway with below details.
URL: https://XXXXXXX.execute-api.us-west-2.amazonaws.com/latest/
Parameters:: ApiVersion=2010-04-01&SmsSid=SM446302f23feac00bdd980eb94af16431&SmsStatus=received&SmsMessageSid=SM446302f23feac00bdd980eb94af16431&NumSegments=1&From=%2B18563135226&ToState=NJ&MessageSid=SM446302f23feac00bdd980eb94af16431&AccountSid=AC056ba4aedfd58f83ad1f8d1827351d3b&ToZip=08057&FromCountry=US&ToCity=MOORESTOWN&FromCity=MOORESTOWN&To=%2B18569246402&FromZip=08057&Body=Hello&ToCountry=US&FromState=NJ&NumMedia=0
Message Text:: Msg=Bad+Request&sourceComponent=14100&ErrorCode=11200&EmailNotification=false&httpResponse=400&LogLevel=ERROR&url=https%3A%2F%2Fzwnu2wzf07.execute-api.us-west-2.amazonaws.com%2Flatest%2F
The API Gateway is not able to process the message.Below is the response from API Gateway.
{"message": "Could not parse request body into json: Unrecognized token \'ToCountry\': was expecting (\'true\', \'false\' or \'null\')\n at [Source: [B@6cbe391e; line: 1, column: 11]"}
application/www-x-form-urlencoded
. If you are going to make a response to Twilio, then it expects the response to be XML, using TwiML. – philnash