无法在除团队通用msbot(nodejs)之外的其他通道中发送消息



我为团队创建了一个机器人程序,并将其作为选项卡添加到通道(testChannel1(中(使用配置页面(。我的服务器收到了ConversationUpdate事件。当我尝试使用在ConversationUpdate事件中收到的上下文对象发送消息时,消息是在常规通道而不是testChannel1中发送的。我已经将我的机器人添加到testChannel1,但我不知道为什么在General中发送消息。我也无法使用它抛出错误Error: This method is only valid within the scope of a MS Teams Team.的上下文对象来获取通道列表。

contextActivity对象:-{ "membersAdded": [ { "id": "28:[guid]" } ], "type": "conversationUpdate", "timestamp": "2020-04-24T12:00:06.7125247Z", "id": "f:[guid]", "channelId": "msteams", "serviceUrl": "https://smba.trafficmanager.net/in/", "from": { "id": "29:[id]", "aadObjectId": "[guid]" }, "conversation": { "isGroup": true, "conversationType": "channel", "tenantId": "[guid]", "id": "19:aba[id]@thread.tacv2" }, "recipient": { "id": "28:[guid]", "name": "teststandups" }, "channelData": { "team": { "aadGroupId": "[guid]", "name": "nikhilp", "id": "19:aba[id]@thread.tacv2" }, "eventType": "teamMemberAdded", "tenant": { "id": "[guid]" } } }

我为我的机器人提供的范围是Team

我将感谢的任何帮助

所以你问了几个问题,我会尽可能地回答。基本上,会话ID(19:aba[ID]@thread.tacv2(在每个通道中都是唯一的,所以如果你使用的是"常规"通道,它肯定会进入"常规"。

要了解如何获取频道ID,请查看获取团队中的频道列表。这将向你展示如何获取信息,但你需要获得触发器才能拨打电话。要做到这一点,最好的方法是挂接其中一个触发器,比如从用户那里接收消息,或者被添加到团队中。这些事件集中包括正在添加和删除的频道。点击此处查看更多信息。

最新更新