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

时间:2019-10-07 05:12:09

标签: asp.net-core .net-core slack slack-api

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

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

weebhook

我在{ "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,我想应该从Slack那里收到一个有效载荷,该有效载荷中设置了有关选定按钮的信息,但是我找不到办法在此json代码中指定一个网址。

1 个答案:

答案 0 :(得分:1)

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

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