是否可以进行 Slack API 不需要的输入?
Is it possible to make an input not required with Slack API?
我正在构建一个带有模态和多个输入的 Slack 应用程序功能。
其中一个是带有一些选项的静态 select。
我想将其设为可选,但似乎没有解决方案。
我试图将 dispatch_action
设置为 false,但我认为它是无关的。
这是我的输入配置:
[
'type' => 'input',
'dispatch_action' => false,
'label' => [
'type' => 'plain_text',
'text' => 'Choose an option (or not)',
],
'element' => [
'type' => 'static_select',
'placeholder' => [
'type' => 'plain_text',
'text' => 'Choose an option',
],
'options' => array_map(static function($data) {
return [
'text' => [
'type' => 'plain_text',
'text' => $data->name,
],
'value' => (string) $data->id,
];
}, $dataValues),
],
],
感谢您的帮助!
您可以添加 "optional": true 作为输入块的 属性。
'type' => 'input',
'optional': true,
'dispatch_action' => false,
我正在构建一个带有模态和多个输入的 Slack 应用程序功能。
其中一个是带有一些选项的静态 select。
我想将其设为可选,但似乎没有解决方案。
我试图将 dispatch_action
设置为 false,但我认为它是无关的。
这是我的输入配置:
[
'type' => 'input',
'dispatch_action' => false,
'label' => [
'type' => 'plain_text',
'text' => 'Choose an option (or not)',
],
'element' => [
'type' => 'static_select',
'placeholder' => [
'type' => 'plain_text',
'text' => 'Choose an option',
],
'options' => array_map(static function($data) {
return [
'text' => [
'type' => 'plain_text',
'text' => $data->name,
],
'value' => (string) $data->id,
];
}, $dataValues),
],
],
感谢您的帮助!
您可以添加 "optional": true 作为输入块的 属性。
'type' => 'input',
'optional': true,
'dispatch_action' => false,