Working on a Slack command I want to have some message menus as attachment. Those need to be dynamically populated, so I registered an options load URL and added the following attachments to my message:
[{
"text": "Request's attributes",
"fallback": "Upgrade your Slack client to use message like these.",
"color": "#3AA3E3",
"attachment_type": "default",
"callback_id":"some ID",
"actions": [{
"name": "priority_list",
"text": "Select a priority",
"type": "select",
"data_source": "external",
}, {
"name": "status_list",
"text": "Select a status",
"type": "select",
"data_source": "external",
}]
}]
My options load URL is properly called by slack and here is what my server responds:
{
options: [{
text: 'Low',
value: 'low'
},
{
text: 'Medium',
value: 'medium'
},
{
text: 'High',
value: 'high'
}
],
selected_options: [{
text: 'High',
value: 'high'
}]}
Looking in Slack I can see the options are dynamically populated. However, none of them are selected.
I am missing something when describing the selected_options
?
Probably figured it out by now but you need to pass a header in the JSON with Content-Type as application/json in order for it to populate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With