【问题标题】:Zapier Webhooks Posting Json ArrayZapier Webhooks 发布 Json 数组
【发布时间】:2017-08-26 23:24:59
【问题描述】:

我无法让 Zapier 的 webhook 发布真正的 JSON 数组。

我希望 webhook 发布数据是这样的:

{
    "attachments": [
    {
        "color": "danger",
        "fallback": "My fallback text is here", 
        "title": "My Title is here",
        "text":" foo"
    }
    ]
}

但我能得到的只是这个(注意缺少的“[”和“]”)。如何从 Zapier 的 webhook 中获取格式正确的 JSON 数组?

{
"attachments": 
    {
    "color": "danger", 
    "text": "foo", 
    "fallback": "My fallback text is here", 
    "title": "My Title is here"
    }
}

我的 Zapier Webhook 配置如下所示:

【问题讨论】:

    标签: arrays json webhooks slack-api zapier


    【解决方案1】:

    默认的 Webhooks >“POST”操作将有效负载值(包括那些看起来像数组的值)强制转换为字符串,因此您不能以这种方式发送数组值。

    您应该使用“自定义请求”操作,而不是“POST”操作。

    此操作允许您指定原始 JSON 负载。只要 JSON 语法良好,您就可以在对象字面量的任何位置插入前面步骤中的字段。

    【讨论】:

      猜你喜欢
      • 2017-10-20
      • 2017-06-28
      • 2023-03-24
      • 2019-06-10
      • 2021-06-26
      • 2021-11-06
      • 2019-10-30
      • 2016-05-14
      • 2013-08-31
      相关资源
      最近更新 更多