Slack:如何在交互式菜单上设置 default/selected 值

Slack: How to set default/selected value on interactive menu

我有 slack 交互式菜单,它工作正常,但我希望在菜单中显示当前选择的值。阅读文档后,我认为附件应该是这样的:

{
    'text': 'settings.slack_notification_time ',
    'fallback': 'oops',
    'color': '#3AA3E3',
    'attachment_type': 'default',
    'callback_id': callback_id,
    'actions': [
        {
            'name': 'notification_time',
            'text': 'Choose a notification_time',
            'type': 'select',
            'selected_options': [
                {
                    'text': '07:00',
                    'value': 7
                }
            ],
            'options': [
                {text:'01:00',value:1},
                {text:'02:00',value:2},
                {text:'03:00',value:3},
                ....

            ]                       
        }
    ]
};

设置所选选项的正确方法是什么?

终于找到问题了。 Slack 显然只能比较字符串 option.value。 将选项列表和 select_options 上的值都强制为字符串,使其工作。