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"

Mark Lester
  • 149
  • 1
  • 3
  • 12

1 Answers1

0

I already solved the problem by reading the documentation I forgot the include the trigger_id and view property

See the correct payload below

{ "trigger_id": "TriggerIdFromRequestPayload", "view": { "type": "modal", "callback_id": "modal-identifier", "title": { "type": "plain_text", "text": "New Post" }, "submit": { "type": "plain_text", "text": "Submit", "emoji": true }, "close": { "type": "plain_text", "text": "Cancel", "emoji": true }, "blocks": [ { "type": "input", "element": { "type": "plain_text_input", "action_id": "title", "placeholder": { "type": "plain_text", "text": "Input title" } }, "label": { "type": "plain_text", "text": "Title" } }, { "type": "input", "element": { "type": "plain_text_input", "multiline": true }, "label": { "type": "plain_text", "text": "Content", "emoji": true } } ] } }

Mark Lester
  • 149
  • 1
  • 3
  • 12