slack block input to variable

i just want to map my inputs to variables in slack,

app.message(':wave:', async ({say}) => {
  await say({
    "blocks": [
      {
        "block_id":"input_1",
        "type": "input",
        "element": {
          "type": "plain_text_input",
          "action_id": "plain_text_input-action"
        },
        "label": {
          "type": "plain_text",
          "text": "Title",
          "emoji": true
        }
      },
      {
        "block_id":"input_2",
        "type": "input",
        "element": {
          "type": "plain_text_input",
          "action_id": "plain_text_input-action2"
        },
        "label": {
          "type": "plain_text",
          "text": "Description",
          "emoji": true
        }
      },
      {
        "type": "actions",
        "elements": [
          {
            "type": "button",
            "text": {
              "type": "plain_text",
              "text": "Post",
              "emoji": true
            },
            "value": "click_me_123",
            "action_id": "actionId-0"
          }
        ]
      }
    ]
  })
});

then ill send it to an api and bla bla, i just want to know how to save the inputs

enter image description here

i just want to save this somewhere, any kind of help will be to much for me, this is my first question here!

Upvotes: 1

Views: 1026

Answers (1)

Isa
Isa

Reputation: 75

If you are trying to save the input values entered by the user, these values are being sent in the modal_submission payload after the user clicks Submit. You can parse this payload in order to access the input values. Here is the Slack API documentation page that describes this payload:

https://api.slack.com/reference/interaction-payloads/views#view_submission

Upvotes: 1

Related Questions