官方文档到目前为止对这个initiate action的说明比较简洁,由于没有一步步的截图和说明,从头到尾看一遍可能还在云里雾里。
我一步步摸索着走了一遍,发现这个initiate action的功能如此强大,不敢独享,所以写此博文:
1. 新建bot,叫TestMsgExt,manifest文件中的composeExtensions部分如下,特别之处是“fetchTask"这个新的属性
"composeExtensions": [
{
"botId": "89e9cdd8-f500-4696-a701-7c2323f62a86",
"canUpdateConfiguration": true,
"commands": [
{
"id": "start",
"type": "action",
"title": "start",
"description": "start",
"initialRun": true,
"fetchTask": true,
"context": [
"commandBox",
"compose",
"message"
],
"parameters": [
{
"name": "param",
"title": "param",
"description": ""
}
]
}
]
}
],
2. 将此bot加入某个teams里,在菜单里就可以看到这个TestMsgExt的bot了
3. 点击后,bot就会收到如下的json
{
"name": "composeExtension/fetchTask",
"type": "invoke",
"timestamp": "2019-06-17T14:32:04.956Z",
"localTimestamp": "2019-06-18T00:32:04.956+10:00",
"id": "f:1361493733941541435",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/apac/",
"from": {
"id": "29:1l8B9m9SOOdHTqLDgmXvSrJyHfwd2ihooa7cxgtzJ8QjQ4WFC4mA_8K2Sa7jL-xUh7g4yh8sZIiDOX6vTtoaz6w",
"name": "Tony Xia",
"aadObjectId": "56c6599d-9216-4078-a8cf-3f039d36e1fd"
},
"conversation": {
"isGroup": true,
"conversationType": "channel",
"tenantId": "aece5000-341d-493a-841d-f67e417f1447",
"id": "19:bf1cbc367561473db0c3fe762c11b508@thread.skype"
},
"recipient": {
"id": "28:89e9cdd8-f500-4696-a701-7c2323f62a86",
"name": "TestMsgExt"
},
"entities": [
{
"locale": "en-US",
"country": "US",
"platform": "Windows",
"type": "clientInfo"
}
],
"channelData": {
"channel": {
"id": "19:bf1cbc367561473db0c3fe762c11b508@thread.skype"
},
"team": {
"id": "19:bf1cbc367561473db0c3fe762c11b508@thread.skype"
},
"tenant": {
"id": "aece5000-341d-493a-841d-f67e417f1447"
},
"s