无法在除 General msbot for teams (nodejs) 之外的其他渠道发送消息

Cannot send messages in other channels except General msbot for teams (nodejs)

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

contextActivityObject :- { "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) 每个频道都是唯一的,因此如果您使用的是 "General" 频道一,它肯定会进入常规。

要了解如何获取频道 ID,请查看 Get the list of channels in a team. That will show you -how- to get the info, but you need to get a trigger in order to be able to make that call. To do that, the best way is to hook into one of the triggers, like receiving a message from a user, or being added to the team. Included in these set of events, are channels being added and deleted. See more here