我要在Slack斜杠命令之后发送此有效负载,并希望根据此Slack手册(https://api.slack.com/surfaces/modals/using#displaying_errors)测试错误响应
我正在发送并在屏幕上显示的有效载荷:
{
"type": "modal",
"submit": {
"type": "plain_text",
"text": "Submit",
"emoji": true
},
"close": {
"type": "plain_text",
"text": "Cancel",
"emoji": true
},
"title": {
"type": "plain_text",
"text": "Workplace check-in",
"emoji": true
},
"blocks": [
{
"type": "input",
"label": {
"type": "plain_text",
"text": "Anything else you want to tell us?",
"emoji": true
},
"element": {
"type": "plain_text_input",
"multiline": true
},
"optional": true
},
{
"type": "input",
"label": {
"type": "plain_text",
"text": "What can we do to improve your experience working here?",
"emoji": true
},
"element": {
"type": "plain_text_input",
"multiline": true
}
},
{
"type": "input",
"label": {
"type": "plain_text",
"text": "What do you want for our team weekly lunch?",
"emoji": true
},
"element": {
"type": "multi_static_select",
"placeholder": {
"type": "plain_text",
"text": "Select your favorites",
"emoji": true
},
"options": [
{
"text": {
"type": "plain_text",
"text": ":pizza: Pizza",
"emoji": true
},
"value": "value-0"
},
{
"text": {
"type": "plain_text",
"text": ":fried_shrimp: Thai food",
"emoji": true
},
"value": "value-1"
},
{
"text": {
"type": "plain_text",
"text": ":desert_island: Hawaiian",
"emoji": true
},
"value": "value-2"
}
]
}
}
]
}
代码应使用Flask处理错误的请求:
if mytype == 'view_submission':
return jsonify ({"response_action": "errors","errors": {"lunch": "You didn't select the right lunch"}}),200
但是,我只是从Slack那里得到答案,说:
我们在连接时遇到了一些麻烦。再试一次?
我对Slack的回复我做错了什么?