Slackbot Openmodal错误:&Quot;缺少字符集&Quot; [英] SlackBot OpenModal Error: "Missing Charset"

查看:14
本文介绍了Slackbot Openmodal错误:&Quot;缺少字符集&Quot;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过Zapier进行API调用,以在Slack中打开一个模式。

但我总是收到错误:

ok: false
error:  invalid_json
warning:    missing_charset
response_metadata:
warnings:
1:  missing_charset

这是我的请求正文:

{
"token":"XXXXXXXXX",
"trigger_id":"XXXXXXXXXX",
"dialog": {
  "callback_id": "projekt-verantwortliche",
  "title": "Projektverantwortliche auswählen",
  "submit_label": "Request",
  "state": "Limo",
  "elements": [
    {
      "type": "users_select",
      "action_id": "projekt-projektleiter",
      "placeholder": {
         "type":"plain_text",
         "text":"Projektleiter auswählen"
        },
    },
     {
      "type": "users_select",
      "action_id":"projekt-berater",
      "placeholder": {
         "type":"plain_text",
         "text":"Berater auswählen"
        }
    }
  ]
}
}

我做错了什么?

这里是整个通话的屏幕截图:

推荐答案

documentation

无法解析包含在POST正文中的JSON。这可能是因为它实际上不是JSON,或者您可能没有正确设置您的HTTP内容类型标头。确保您的JSON属性键是用双引号(&Quot;)字符括起来的字符串。

您只需删除一个逗号,即可正常工作:

{
   "token":"XXXXXXXXX",
   "trigger_id":"XXXXXXXXXX",
   "dialog":{
      "callback_id":"projekt-verantwortliche",
      "title":"Projektverantwortliche auswählen",
      "submit_label":"Request",
      "state":"Limo",
      "elements":[
         {
            "type":"users_select",
            "action_id":"projekt-projektleiter",
            "placeholder":{
               "type":"plain_text",
               "text":"Projektleiter auswählen"
            }
         },
         {
            "type":"users_select",
            "action_id":"projekt-berater",
            "placeholder":{
               "type":"plain_text",
               "text":"Berater auswählen"
            }
         }
      ]
   }
}

如果set the charset为内容类型标头,则可以删除警告missing_charset。例如:

Content-type: application/json; charset=utf-8

这篇关于Slackbot Openmodal错误:&Quot;缺少字符集&Quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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