BotFramework Composer 和 Slack Block 套件
BotFramework Composer and Slack Block Kit
如何使用 C# slack-adapter 从 Bot Framework Composer Bot 发送 BlockKit 附件?
我正在尝试在 .lg 中使用它,但到达松弛客户端的唯一消息是:值不能为空。 (参数'uriString')
# SendSlackResponse()
[Activity
Attachments = ${json(SlackMessage())}
]
# SlackMessage()
- ```
{
"type": "application/json",
"name": "blocks",
"content": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello, Assistant to the Regional Manager Dwight! *Michael Scott* wants to know where yo``u'd like to take the Paper Company investors to dinner tonight.\n\n *Please select a restaurant:*"
}
}
]
}
```
问题是第一个类型 属性 必须是“附件”。
否则,对话管理器将创建一个 Activity,仅包含一个 属性 类型和一个 属性 内容,它会在其中添加我的 json:https://github.com/microsoft/botbuilder-dotnet/blob/c98feb7c58a5564cd8d31bedf050819af70058a3/libraries/Microsoft.Bot.Builder/ActivityFactory.cs#L210
然后名称 属性 不在 att.name 之下,而是在 att.content.name 之下,这使得松弛适配器在将 activity 转换为松弛消息,期望传递 Uri,因此出现错误:
https://github.com/microsoft/botbuilder-dotnet/blob/main/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Slack/SlackHelper.cs#L56
有效的json(只需要修改根目录下的属性类型):
{
"type": "Attachment",
"name": "blocks",
"content": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${answer}"
}
},
{
"type": "divider"
},
...MORE JSON HERE....
]
}
如何使用 C# slack-adapter 从 Bot Framework Composer Bot 发送 BlockKit 附件?
我正在尝试在 .lg 中使用它,但到达松弛客户端的唯一消息是:值不能为空。 (参数'uriString')
# SendSlackResponse()
[Activity
Attachments = ${json(SlackMessage())}
]
# SlackMessage()
- ```
{
"type": "application/json",
"name": "blocks",
"content": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello, Assistant to the Regional Manager Dwight! *Michael Scott* wants to know where yo``u'd like to take the Paper Company investors to dinner tonight.\n\n *Please select a restaurant:*"
}
}
]
}
```
问题是第一个类型 属性 必须是“附件”。 否则,对话管理器将创建一个 Activity,仅包含一个 属性 类型和一个 属性 内容,它会在其中添加我的 json:https://github.com/microsoft/botbuilder-dotnet/blob/c98feb7c58a5564cd8d31bedf050819af70058a3/libraries/Microsoft.Bot.Builder/ActivityFactory.cs#L210
然后名称 属性 不在 att.name 之下,而是在 att.content.name 之下,这使得松弛适配器在将 activity 转换为松弛消息,期望传递 Uri,因此出现错误: https://github.com/microsoft/botbuilder-dotnet/blob/main/libraries/Adapters/Microsoft.Bot.Builder.Adapters.Slack/SlackHelper.cs#L56
有效的json(只需要修改根目录下的属性类型):
{
"type": "Attachment",
"name": "blocks",
"content": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${answer}"
}
},
{
"type": "divider"
},
...MORE JSON HERE....
]
}