Cam*_* S. 5 arrays json webhooks zapier slack-api
我无法让Zapier的webhooks发布真正的JSON数组.
我希望webhook帖子数据是这样的:
{
"attachments": [
{
"color": "danger",
"fallback": "My fallback text is here",
"title": "My Title is here",
"text":" foo"
}
]
}
Run Code Online (Sandbox Code Playgroud)
但我能得到的就是这个(注意缺少的"["和"]").如何从Zapier的webhook中获取格式正确的JSON数组?
{
"attachments":
{
"color": "danger",
"text": "foo",
"fallback": "My fallback text is here",
"title": "My Title is here"
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的Zapier Webhook配置的样子:
默认的Webhooks>"POST"操作会将有效负载值(包括那些看起来像数组的值)强制转换为字符串,因此您无法以这种方式发送数组值.
您应该使用"自定义请求"操作,而不是"POST"操作.

此操作允许您指定原始JSON有效内容.只要JSON语法良好,您就可以在对象文字中的任何位置插入先前步骤中的字段.