Netcore服务器响应松弛的交互式消息

问题描述 投票:0回答:1

我正在尝试使用ASP网络核心服务器构建Slack application。当前,我添加了Slash命令,该命令通过ngrok向本地服务器发出请求。我的服务器接收到该请求后,便对配置为slack webhook的发布请求,以显示类似于附件中的图片的交互式消息。 enter image description here

我希望用户能够选择是或否,并在我的控制器中接收结果,但是我不知道如何告诉Slack应该在哪里发出发布请求。我将此消息的代码附加到通过weebhook发布到Slack的代码中:

{
"blocks": [
    {
        "type": "section",
        "text": {
            "type": "mrkdwn",
            "text": "This is a section block with a button."
    }
    },
    {
        "type": "actions",
        "block_id": "actionblock789",
        "elements": [
            {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "text": "Yes"
                },
                "style": "primary",
                "value": "yes"
            },
            {
                "type": "button",
                "text": {
                    "type": "plain_text",
                    "text": "No"
                },
                "value": "no"
            }
        ]
    }
]
}

我在netcore中拥有的是TestController,其路由为/api/test,我想应该从Slack接收一个有效载荷,其中设置了有关所选按钮的信息,但是我找不到在此json中指定url的方法码。希望您能够帮助我。谢谢

asp.net-core .net-core slack slack-api
1个回答
0
投票

您无法在JSON代码中配置URL。这不是Slack API的工作方式。

Slack将对交互式消息的所有响应(例如有人单击按钮时)发送到您的Slack应用的已配置请求URL。查看此链接如何找到该参数:documentation

© www.soinside.com 2019 - 2024. All rights reserved.