我在Microsoft Teams中拥有一个机器人,该机器人正在使用REST API进行管理。我发送带有以下调用操作的卡:
{
type: "Action.Submit",
title: "Run task",
data: {
msteams: {
type: "invoke",
title: "Run task",
value: JSON.stringify({"key1": "value", "key1": "value"})
}
}
}
按钮正确呈现,并在单击时通过HTTP POST发送以下正文:
{
name: 'task/fetch',
type: 'invoke',
timestamp: '2020-08-14T05:01:40.651Z',
localTimestamp: '2020-08-14T01:01:40.651-04:00',
id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
channelId: 'msteams',
serviceUrl: 'https://smba.trafficmanager.net/amer/',
from:
{ id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
name: 'Suchit Agarwal',
aadObjectId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
},
conversation: {
conversationType: 'personal',
tenantId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
},
recipient: {
id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
name: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
},
entities: [{
locale: 'en-US',
country: 'US',
platform: 'Mac',
type: 'clientInfo'
}],
channelData: {
tenant: { id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx' },
source: { name: 'compose' }
},
value: {
data: {
requestId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
taskUUID: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
type: 'task/fetch',
viewType: 'run_task'
},
context: { theme: 'default' }
},
locale: 'en-US'
}
但是,请注意,收到的消息缺少replyToId。如何将其返回服务器,以便更新卡操作来自的消息,如此处所述:https://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-actions#example-incoming-invoke-message
感谢您的帮助。