0

I'm technical, but not experienced in coding and could use some help. I need to create an http request from Twilio studio. I am setting up a phone survey for my client and I need to log both voice and number inputs from the call to a database. I already have the database set up externally. It logs responses with an http request from CLI curl. I'm using the following curl request successfully:

curl --data "q=1 -X POST localhost/test.php

When I try to duplicate the same curl request using the http request widget (no http parameters), I only get error 500 back. By the way, I know it's collecting the data correctly with the flow because I've had it collect and then read back to me successfully.

Twilio studio http request.

I have tried adding http parameters instead of putting them in the body as well. Nothing I try works. My guess is that I have a fundamental misunderstanding of http requests and thus can't duplicate it in Twilio.

Any help you could give me would be great! Thank you!

tpeabody
  • 1
  • 1

1 Answers1

0

When you add http parameters instead of putting them in the body (see the capture below)


enter image description here

there is a big red "Save" button on bottom left corner, and a gray (hard to see and easy to miss) "Save" link on the right, above the trash bin.

The gray "Save" link needs to be clicked when adding each name/value pair of the parameters.

The red "Save" button is to be clicked at the end when you're done with the http widget.

Alex Baban
  • 11,312
  • 4
  • 30
  • 44
  • I've tried this as well, and I can't seem to extract the data from the parameter. I'm not entirely sure what I'm doing wrong. Here is the php I'm using: `` – tpeabody Dec 13 '19 at 21:38
  • With a tool like Postman or cURL you can replicate the POST request Twilio should make to your endpoint. Does your code work then? – Alex Baban Dec 14 '19 at 03:27
  • I have done a cURL in terminal without changing around the code I posted above and got it to save into the database no problem. The problem I'm getting back from Twilio is a "Outbound HTTP Request Failed" and a possible cause they list is a badly formed response (or a 4xx/5xx error). I'm guessing it's an error 500 which doesn't seem to tell me much given it's such a generic error code. – tpeabody Dec 15 '19 at 23:38