如果正文是 JSON,twilio studio 不允许在 http 请求中包含标头 [英] twilio studio does not allow headers in http requests if the body is JSON

查看:22
本文介绍了如果正文是 JSON,twilio studio 不允许在 http 请求中包含标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Twilio Studio 设计 IVR,因此它保持模块化和灵活性.在某些时候,我必须对外部应用程序使用小部件http 请求".当我完成小部件时,如果我选择内容类型应用程序/JSON"而不是表单 URL 编码"(这是我的外部应用程序需要的),那么听者的字段就会消失,并且不可能再指定授权/Bearer 就像一个普通的 POST 请求.如果我切换回从 URL 编码",则该字段再次出现.

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 ?

我已经浏览了我找到的所有文档(Twilio、堆栈溢出;谷歌),并且我尝试从 Chrome 和 Firefox 切换,但它保持不变.

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.

有人有想法吗?

NB 我想我可以通过创建一个后端应用程序来解决这个问题,比如一个 Twilio 函数,它可以在没有授权承载的情况下被一个帖子调用,它会将我的 JSON POST 到外部应用程序(带有授权和承载,内部硬编码)功能).但后来我最好停止使用 twilio studio 并在函数中编写所有内容......我想避免的.提前谢谢

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

推荐答案

Twilio 开发人员布道者在这里.

Twilio developer evangelist here.

您可以添加到 HTTP 请求小部件的参数是正文参数,而不是标头.因此,您无法使用任何一种 HTTP 请求方式来实现这一点.

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.

相反,我建议使用 Twilio Function 小部件向您的外部应用程序发出请求.您不需要在中间使用 HTTP 小部件,您可以直接在函数中完成.然后,该函数可以处理您的自定义 HTTP 请求并将详细信息传递回 Studio 流,只要它以 JSON 响应即可.

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.

这篇关于如果正文是 JSON,twilio studio 不允许在 http 请求中包含标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆