Netcore 服务器响应 slack 交互消息
Netcore server respond to slack interactive message
我正在尝试使用 asp 网络核心服务器构建 Slack application
。目前,我添加了 Slash 命令,它通过 ngrok
向我的本地服务器发出请求。一旦我的服务器收到该请求,它就会发出 post 请求以配置 slack webhook
以显示看起来像来自附件的图片的交互式消息。
我希望用户能够 select 是或否并在我的控制器中接收结果,但我不知道如何告诉 Slack 应该在哪里发出 post 请求。我将通过 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 接收一个有效负载,其中设置了有关 selected 按钮的信息,但是我找不到在此 json 代码中指定 url 的方法。
您不能在 JSON 代码中配置 URL。这不是它与 Slack API 一起工作的方式。
Slack 会将对交互式消息的所有响应(例如当有人单击按钮时)发送到您的 Slack 应用程序的配置请求 URL。查看此 link 如何找到该参数:documentation
我正在尝试使用 asp 网络核心服务器构建 Slack application
。目前,我添加了 Slash 命令,它通过 ngrok
向我的本地服务器发出请求。一旦我的服务器收到该请求,它就会发出 post 请求以配置 slack webhook
以显示看起来像来自附件的图片的交互式消息。
我希望用户能够 select 是或否并在我的控制器中接收结果,但我不知道如何告诉 Slack 应该在哪里发出 post 请求。我将通过 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 接收一个有效负载,其中设置了有关 selected 按钮的信息,但是我找不到在此 json 代码中指定 url 的方法。
您不能在 JSON 代码中配置 URL。这不是它与 Slack API 一起工作的方式。
Slack 会将对交互式消息的所有响应(例如当有人单击按钮时)发送到您的 Slack 应用程序的配置请求 URL。查看此 link 如何找到该参数:documentation