SlackBot OpenModal Error: "Missing Charset"
SlackBot OpenModal Error: "Missing Charset"
我想通过 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中找到解决方案:
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"
}
}
]
}
}
如果 set the charset content-type header,则可以删除警告 missing_charset
。例如:
Content-type: application/json; charset=utf-8
我想通过 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中找到解决方案:
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"
}
}
]
}
}
如果 set the charset content-type header,则可以删除警告 missing_charset
。例如:
Content-type: application/json; charset=utf-8