gpt4 book ai didi

SlackBot OpenModal 错误 : "Missing Charset"

转载 作者:行者123 更新时间:2023-12-05 01:10:58 25 4
gpt4 key购买 nike

我想通过 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"
}
}
]
}
}

我做错了什么?

这是整个通话的截图: enter image description here

最佳答案

可以在这个 documentation 中找到解决方案:

The JSON you've included in your POST body cannot be parsed. This might be because it's actually not JSON, or perhaps you did not correctly set your HTTP Content-type header. Make sure your JSON attribute keys are strings wrapped with double-quote (") characters.

你只需要删除一个逗号,然后它应该工作:

{
"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"
}
}
]
}
}

您可以删除警告 missing_charset 如果您 set the charset对于内容类型标题。例如:

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

关于SlackBot OpenModal 错误 : "Missing Charset",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63550032/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com