简体   繁体   English

使用 Bot Framework 通过 NodeJS 发布到 Microsoft Teams 频道

[英]Using the Bot Framework to post to a Microsoft Teams channel with NodeJS

Is there a way to send proactive cards from a bot to a Teams channel?有没有办法将主动卡片从机器人发送到 Teams 频道? The use case is a channel for service tickets.用例是服务票证的渠道。 Once they get posted, a user will be able to interact with them with a few actions.一旦他们被发布,用户将能够通过一些动作与他们互动。

I'm looking at the documentation here for sending proactive messages.我正在查看此处发送主动消息的文档 At the bottom, there's a section for ”Creating channel conversations”, with a small reference to the startReplyChain() .在底部,有一个“创建频道对话”的部分,其中有一个对startReplyChain()的小参考。 However, the actual code and sample on GitHub still seem to reference a conversation with a member rather than sending something proactive to a channel.然而,GitHub 上的实际代码和示例似乎仍然引用了与成员的对话,而不是主动向频道发送内容。

There does appear to be documentation for incoming and outgoing webhooks, which is what I may end up doing.似乎确实有传入和传出 webhook 的文档,这就是我最终可能要做的。 My only real concern is that it requires using Actionable Cards, which it references as legacy everywhere.我唯一真正担心的是它需要使用可操作卡片,它在任何地方都将其称为遗留物。 This is despite saying that you can't send Adaptive Cards with them.这是尽管说你不能用它们发送自适应卡。 Perhaps they intend to enable these connectors to send Adaptive Cards, it's not just very clear to me if this is a long-term solution I should be focusing on.也许他们打算使这些连接器能够发送自适应卡,我不太清楚这是否是我应该关注的长期解决方案。

This is definitely possible, and it's important to note that you can even send from another process/application (eg on a schedule from an AWS Lamba).这绝对是可能的,重要的是要注意您甚至可以从另一个进程/应用程序发送(例如,根据 AWS Lamba 的计划)。 You can see a sample here for this.您可以在此处查看示例。

The process of sending the message is just part of the story though - you need to have certain information already saved (eg in your database) to know how to contact the right user, group chat, or channel conversation, but there are a few ways to get that information.发送消息的过程只是故事的一部分 - 您需要已经保存了某些信息(例如在您的数据库中)才能知道如何联系正确的用户、群聊或频道对话,但有几种方法获取该信息。 The most common is, when you bot is added to the conversation, to get it from the conversationUpdate event.最常见的是,当你的机器人被添加到对话中时,从 conversationUpdate 事件中获取它。 You'll need conversation id, service url, tenant id, and your bot's App Id (what you get in the Azure portal for your bot, and which you're using already in your app's configuration, teams manifest, etc.).您将需要对话 ID、服务 url、租户 ID 和机器人的应用程序 ID(您在机器人的 Azure 门户中获得的内容,以及您已经在应用程序配置、团队清单等中使用的内容)。 You can read more about the topic here and here .您可以在此处此处阅读有关该主题的更多信息。

Another option, if you don't have access to conversationUpdate (eg the user hasn't installed your app) is to call the Graph API to install your app.如果您无权访问 conversationUpdate(例如,用户尚未安装您的应用程序),另一种选择是调用 Graph API 来安装您的应用程序。 It's only possible to do this to a channel (on the v1 or beta api) (see here ) or to a user (see here ), but on the beta api only, and not (yet?) for a group chat.只能对频道(在 v1 或 beta api 上)(参见此处)或用户(参见此处)执行此操作,但仅在 beta api 上执行此操作,而不是(还?)用于群聊。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 nodejs 向微软团队频道发送消息 - Send message to microsoft teams channel using nodejs Nodejs和microsoft bot框架 - Nodejs and microsoft bot framework 如何让我的机器人向Microsoft Teams频道发布消息? - How can I get my bot to post a message to a Microsoft Teams channel? 如何从Microsoft Bot Framework发送SMS(使用Twilio通道)? - How to send SMS (using Twilio channel) from Microsoft Bot Framework? 使用NodeJS中的Microsoft Bot Framework将Excel内容作为附件发送 - Sending Excel Content as attachment using Microsoft Bot Framework in NodeJS 使用 Microsoft Bot Framework,当我在 Messenger 频道上写作时,如何将结果推送到特定的 Slack 频道? (带节点) - Using Microsoft Bot Framework, when I write on Messenger channel, how to push the result to a specific Slack channel ? (with Node) Microsoft团队-读出频道消息(ReactJS,NodeJS) - Microsoft Teams - read out channel messages (ReactJS, NodeJS) bot框架v4是否可以在Microsoft-Teams中获取PowerBI报告屏幕截图或报告? - is it possible to get the PowerBI report Screenshot or reports inside Microsoft-Teams using bot framework v4? Microsoft Teams Bot-Framework 技能对话框:endDialog() 不起作用 - Microsoft Teams Bot-Framework Skill Dialog: endDialog() does not work Microsoft bot 框架移交解决方案以支持 MS Teams 中的代理 - Microsoft bot framework handover solution to support agents in MS Teams
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM