twilio studio does not allow headers in http requests if the body is JSON

感情迁移 提交于 2019-12-11 06:05:04

问题


I am designing an IVR with Twilio studio, so it remains modular and flexible. At some point I have to use the widget "http request" to an external application. When I complete the widget, if I select content type "Application/JSON" instead of "Form URL Encoded" (this is needed by my external application), then the field of the hearders dissapears and it is not possible annymore to specify a Authorization/Bearer like a normal POST request. If I switch back to "From URL encoded", then the field appears again.

Is this a bug ? is this a feature ? do I do something wrong ?

I have been through all the doc I found (Twilio, stack overflow; google), and I tried to switch from Chrome and Firefox, but it remains the same.

Anybody an idea please ?

NB I think I can solve this by creating a backend app like a Twilio function that can be called by a post without authorization bearer and it will do the POST of my JSON to the external app (with authorization and bearer, hardcoded inside the function). But then I could better stop using twilio studio and code everything in the function ... what I wanted to avoid. Thx in advance


回答1:


Twilio developer evangelist here.

The parameters that you can add to the HTTP request widget are body parameters, not headers. So you can't achieve this with either style of HTTP request.

Instead, I would recommend using the Twilio Function widget to make the request to your external application. You don't need to use an HTTP widget in the middle there, you can do it straight in the Function. The Function can then handle your custom HTTP request and pass the details back to the Studio flow as long as it responds with JSON.



来源:https://stackoverflow.com/questions/53615925/twilio-studio-does-not-allow-headers-in-http-requests-if-the-body-is-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!