Reputation: 31
I'm trying to get the submitted data from a slack modal payload (using Integromat) but I'm unable to match the fields as the field names (block_ids) and random and change on each submission.
Not sure where to start, is there something on the Slack side I can do to stop this or how can I handle this in Integromat?
Payload below:
{
"blocks":[
{
"type":"header",
"block_id":"GH6Wh",
"text":{
"type":"plain_text",
"text":"AHome",
"emoji":true
}
},
{
"type":"input",
"block_id":"ayv5",
"label":{
"type":"plain_text",
"text":"Project Title",
"emoji":true
},
"optional":false,
"dispatch_action":false,
"element":{
"type":"plain_text_input",
"action_id":"field_project_title",
"dispatch_action_config":{
"trigger_actions_on":[
"on_enter_pressed"
]
}
}
},
{
"type":"input",
"block_id":"4Tf7",
"label":{
"type":"plain_text",
"text":"Client Project Contacts",
"emoji":true
},
"optional":false,
"dispatch_action":false,
"element":{
"type":"multi_static_select",
"action_id":"client_project_contacts",
"placeholder":{
"type":"plain_text",
"text":"Select",
"emoji":true
},
"options":[
{
"text":{
"type":"plain_text",
"text":"jennifer",
"emoji":true
},
"value":"47dht5f-1942-4448-9842-20fef64dcd67"
}
]
}
},
{
"type":"divider",
"block_id":"a=6G"
},
{
"type":"section",
"block_id":"qtq0W",
"text":{
"type":"mrkdwn",
"text":"Project Start",
"verbatim":false
},
"accessory":{
"type":"datepicker",
"action_id":"field_project_start_date",
"initial_date":"2022-01-19",
"placeholder":{
"type":"plain_text",
"text":"Select a date",
"emoji":true
}
}
},
{
"type":"section",
"block_id":"4YOTI",
"text":{
"type":"mrkdwn",
"text":"Project Finish",
"verbatim":false
},
"accessory":{
"type":"datepicker",
"action_id":"field_project_end_date",
"initial_date":"2022-03-19",
"placeholder":{
"type":"plain_text",
"text":"Select a date",
"emoji":true
}
}
},
{
"type":"divider",
"block_id":"MZU"
},
{
"type":"input",
"block_id":"v09",
"label":{
"type":"plain_text",
"text":"Project Manager",
"emoji":true
},
"optional":false,
"dispatch_action":false,
"element":{
"type":"static_select",
"action_id":"field_project_managers",
"placeholder":{
"type":"plain_text",
"text":"Select",
"emoji":true
},
"options":[
{
"text":{
"type":"plain_text",
"text":"Eric ",
"emoji":true
},
"value":"b85ba51b-2346-481f-98a8-2b94fh994575"
}
]
}
},
{
"type":"input",
"block_id":"gxN9",
"label":{
"type":"plain_text",
"text":"Project Team",
"emoji":true
},
"optional":false,
"dispatch_action":false,
"element":{
"type":"multi_static_select",
"action_id":"field_project_team",
"placeholder":{
"type":"plain_text",
"text":"Select",
"emoji":true
},
"options":[
]
}
},
{
"type":"divider",
"block_id":"CU1k"
},
{
"type":"input",
"block_id":"ows",
"label":{
"type":"plain_text",
"text":"Setup apps",
"emoji":true
},
"optional":true,
"dispatch_action":false,
"element":{
"type":"checkboxes",
"action_id":"setup_apps",
"options":[
{
"text":{
"type":"plain_text",
"text":"Harvest",
"emoji":true
},
"value":"setup_harvest"
},
{
"text":{
"type":"plain_text",
"text":"Dropbox Project Folder",
"emoji":true
},
"value":"setup_dropbox"
}
]
}
},
{
"type":"divider",
"block_id":"Eov"
}
],
"private_metadata":"",
"callback_id":"_project_setup_form_submit",
"state":{
"values":{
"ayv5":{
"field_project_title":{
"type":"plain_text_input",
"value":"cvgf"
}
},
"4Tf7":{
"client_project_contacts":{
"type":"multi_static_select",
"selected_options":[
{
"text":{
"type":"plain_text",
"text":"Jennifer",
"emoji":true
},
"value":"04a96f00-c84d-403c-992f-28fgh34b7ade"
}
]
}
},
"qtq0W":{
"field_project_start_date":{
"type":"datepicker",
"selected_date":"2022-01-19"
}
},
"4YOTI":{
"field_project_end_date":{
"type":"datepicker",
"selected_date":"2022-03-19"
}
},
"v09":{
"field_project_managers":{
"type":"static_select",
"selected_option":{
"text":{
"type":"plain_text",
"text":"Eric",
"emoji":true
},
"value":"b85ba51b-2346-481f-9sa8-2b9468994575"
}
}
},
"gxN9":{
"field_project_team":{
"type":"multi_static_select",
"selected_options":[
{
"text":{
"type":"plain_text",
"text":"Elliot",
"emoji":true
},
"value":"94c4b483-fbg8-4211-971d-38cf615fdc5e"
}
]
}
},
"ows":{
"setup_apps":{
"type":"checkboxes",
"selected_options":[
{
"text":{
"type":"plain_text",
"text":"Harvest",
"emoji":true
},
"value":"setup_harvest"
}
]
}
}
}
}
}
Upvotes: 3
Views: 747
Reputation: 11
When creating a view, you can (but aren't required to) specify a "block_id"
as a property for each block. When an ID isn't provided, it seems to be randomly-generated each time.
Example:
{
"type": "modal",
"callback_id": "modal-identifier",
"title": {
"type": "plain_text",
"text": "Just a modal"
},
"blocks": [
{
"type": "section",
"block_id": "section-identifier",
"text": {
"type": "mrkdwn",
"text": "*Welcome* to ~my~ Block Kit _modal_!"
},
"accessory": {
"type": "button",
"block_id": "just-a-button",
"text": {
"type": "plain_text",
"text": "Just a button",
},
"action_id": "button-identifier",
}
}
],
}
Source, and I added a second "block_id"
for the button.
Upvotes: 1