【发布时间】:2019-05-15 22:56:25
【问题描述】:
我正在尝试创建一个使用 Teams 中的两个参数的消息传递扩展。
我创建了一个消息扩展,它在清单中采用两个参数。在此之后,我使用 node 中的 botbuilder-teams v4.0.0-beta1 包制作了一个机器人服务器。
清单包含以下内容:
"composeExtensions": [
{
"botId": "########-####-####-####-############",
"canUpdateConfiguration": true,
"commands": [
{
"id": "Test",
"title": "Test",
"description": "test",
"initialRun": true,
"parameters": [
{
"name": "Param1",
"title": "Param 1",
"description": "This is param 1"
},
{
"name": "Param2",
"title": "param 2",
"description": "param 2"
}
]
}
]
}
],
我的服务器中有以下代码来回复消息扩展请求
private onMessagingExtensionQuery = async (ctx: TurnContext, query: teams.MessagingExtensionQuery): Promise<teams.InvokeResponseTyped<teams.MessagingExtensionResponse>> => {
console.log(query);
type R = teams.InvokeResponseTypeOf<'onMessagingExtensionQuery'>;
let heroCard1 = CardFactory.heroCard('Result Card1', '<pre>This card mocks the CE results 1</pre>');
let heroCard2 = CardFactory.heroCard('Result Card2', '<pre>This card mocks the CE results 2</pre>');
let response: R = {
status: 200,
body: {
composeExtension: {
type: 'result',
attachmentLayout: 'list',
attachments: [
{...heroCard1},
{...heroCard2}
]
}
}
};
return Promise.resolve(response);
};
当我尝试使用我的消息扩展程序时,我输入第一个参数并显示两个结果卡,我可以选择一个。但是,在此之后我没有选择输入第二个参数。相反,我只是将聊天框中的选定卡片准备好发送到我的机器人。
如何使用这两个消息传递扩展参数?
谢谢
【问题讨论】:
-
@Gousia-MSFT 感谢您的回复,如果您愿意,我会将其标记为已接受的答案。
标签: botframework microsoft-teams