Slack Block-kit Multi_users_select 删除默认应用

Slack Block-kit Multi_users_select Remove defaults app

我实现了一个带有输入类型 um 字段的 slack 机器人 (multi_users_select)。我想从列表中删除默认应用 select?

{
            type: 'input',
            element: {
                type: 'multi_users_select',
                action_id: input.actionId,
                initial_users: input.initial_users,
            },
            label: {
                type: 'plain_text',
                text: input.text,
                emoji: input.emoji,
            },
        };

目前,过滤功能可用于对话 select 菜单或对话多 select 菜单。 https://api.slack.com/reference/block-kit/composition-objects#filter_conversations

也许你可以写信给反馈@slack.com,他们可以记录下来以备将来发布。

而不是 type: 'multi_users_select' 使用 "type": "multi_conversations_select"filter 如下所示,以仅获取工作区中的用户。 您可以将以下代码复制并粘贴到 block-kit builder 中以自行测试。 https://app.slack.com/block-kit-builder/

{
    "title": {
        "type": "plain_text",
        "text": "Blocker-Bot"
    },
    "submit": {
        "type": "plain_text",
        "text": "Submit"
    },
    "type": "modal",
    "callback_id": "custom_time_select",
    "private_metadata": "private-data",
    "blocks": [
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "Test block with multi conversations select"
            },
            "accessory": {
                "type": "multi_conversations_select",
                "placeholder": {
                    "type": "plain_text",
                    "text": "Select conversations",
                    "emoji": true
                },
                "filter": {
                    "include": [
                        "im"
                    ],
                    "exclude_bot_users": true
                },
                "action_id": "multi_conversations_select-action"
            }
        }
    ]
}

21 年 7 月 5 日更新

包括 select 没有 bots/apps

的各种其他类型的用户
{
    "type": "modal",
    "title": {
        "type": "plain_text",
        "text": "My App",
        "emoji": true
    },
    "submit": {
        "type": "plain_text",
        "text": "Submit",
        "emoji": true
    },
    "close": {
        "type": "plain_text",
        "text": "Cancel",
        "emoji": true
    },
    "blocks": [
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "Conversations type Select user"
            },
            "accessory": {
                "type": "conversations_select",
                "placeholder": {
                    "type": "plain_text",
                    "text": "Select a user",
                    "emoji": true
                },
                "filter": {
                    "include": [
                        "im"
                    ],
                    "exclude_bot_users": true
                },
                "action_id": "users_select-action"
            }
        },
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": "Multi Conversations type Select users"
            },
            "accessory": {
                "type": "multi_conversations_select",
                "placeholder": {
                    "type": "plain_text",
                    "text": "Select conversations",
                    "emoji": true
                },
                "filter": {
                    "include": [
                        "im"
                    ],
                    "exclude_bot_users": true
                },
                "action_id": "multi_conversations_select-action"
            }
        },
        {
            "type": "input",
            "element": {
                "type": "multi_conversations_select",
                "placeholder": {
                    "type": "plain_text",
                    "text": "Select users",
                    "emoji": true
                },
                "filter": {
                    "include": [
                        "im"
                    ],
                    "exclude_bot_users": true
                },
                "action_id": "multi_users_select-action"
            },
            "label": {
                "type": "plain_text",
                "text": "Input type Select users",
                "emoji": true
            }
        }
    ]
}