0

I'm trying to make a bot in slack. I created a slash command with /showmodal, when the command triggered my api return this json

{
"type": "modal",
"title": {
    "type": "plain_text",
    "text": "My App",
    "emoji": true
},
"submit": {
    "type": "plain_text",
    "text": "Submit",
    "emoji": true
},
"close": {
    "type": "plain_text",
    "text": "Cancel",
    "emoji": true
},
"blocks": [
    {
        "type": "input",
        "element": {
            "type": "plain_text_input",
            "multiline": true
        },
        "label": {
            "type": "plain_text",
            "text": "Label",
            "emoji": true
        }
    }
]}

I'm expecting this result

enter image description here

But I'm getting this response instead of the modal

/showmodal failed with the error "invalid_blocks"

4

1 回答 1

0

我已经通过阅读我忘记包含 trigger_id 和 view 属性的文档解决了这个问题

请参阅下面的正确有效载荷

{“trigger_id”:“TriggerIdFromRequestPayload”,“view”:{“type”:“modal”,“callback_id”:“modal-identifier”,“title”:{“type”:“plain_text”,“text”:“新帖子“},“提交”:{“类型”:“纯文本”,“文本”:“提交”,“表情符号”:true},“关闭”:{“类型”:“纯文本”,“文本”: “取消”、“表情符号”:真 }、“块”:[ { “类型”:“输入”、“元素”:{ “类型”:“plain_text_input”、“action_id": "title", "placeholder": { "type": "plain_text", "text": "输入标题" } }, "label": { "type": "plain_text", "text": "Title " } }, { "type": "input", "element": { "type": "plain_text_input", "multiline": true }, "label": { "type": "plain_text", "text": “内容”、“表情符号”:真 } } ] } }{ "type": "plain_text", "text": "输入标题" } }, "label": { "type": "plain_text", "text": "Title" } }, { "type": "input ", "元素": { "type": "plain_text_input", "multiline": true }, "label": { "type": "plain_text", "text": "Content", "emoji": true } } ] } }{ "type": "plain_text", "text": "输入标题" } }, "label": { "type": "plain_text", "text": "Title" } }, { "type": "input ", "元素": { "type": "plain_text_input", "multiline": true }, "label": { "type": "plain_text", "text": "Content", "emoji": true } } ] } }“标签”:{“类型”:“纯文本”,“文本”:“标题”}},{“类型”:“输入”,“元素”:{“类型”:“纯文本输入”,“多行”:真},“标签”:{“类型”:“plain_text”,“文本”:“内容”,“表情符号”:真 } } ] } }“标签”:{“类型”:“纯文本”,“文本”:“标题”}},{“类型”:“输入”,“元素”:{“类型”:“纯文本输入”,“多行”:真},“标签”:{“类型”:“plain_text”,“文本”:“内容”,“表情符号”:真 } } ] } }plain_text_input", "multiline": true }, "label": { "type": "plain_text", "text": "Content", "emoji": true } } ] } }plain_text_input", "multiline": true }, "label": { "type": "plain_text", "text": "Content", "emoji": true } } ] } }

于 2020-02-27T03:08:57.723 回答