2

Here is my scenario: I am using Twilio to send SMSes to my clients. When user decides not to receive these SMSes they reply STOP and START to receive again. This is automatically handled by Twilio. But, i need to invoke a AWS Lambda function and update my database accordingly.

This is what i am doing till now: 1. I have created a TwiML App 2. I have added this TwilML App to my Twilio number. 3. Created a Lambda Function and API Gateway. Added the end-point in TwiML App.

Adding AWS Lambda - API Gateway to TwiML App enter image description here

Adding TwiML App to my Twilio Phone Number enter image description here

I am getting the SMS Logs saying that the user has sent START/STOP from his phone number, but, the Lambda function is not getting invoked.

Here is the SMS Log from Twilio: enter image description here enter image description here enter image description here enter image description here

Can someone help me understand what's going wrong? And what it means when the response is "Unsupported media type"?

Vamsi Challa
  • 11,038
  • 31
  • 99
  • 149

1 Answers1

1

If you're using Java code for your TwiML app, have you specified the XML content type for TwiML as such:

    response.setContentType("application/xml");
    response.getWriter().print(twiml.toXML());

That could be one of a handful of causes as explained in the link from the comments.

Megan Speir
  • 3,745
  • 1
  • 15
  • 25