自动/批处理消息发布到Microsoft-Teams聊天室 [英] Automated/Bot message posting to Microsoft-Teams chat room
问题描述
如何自动将消息发布到Microsoft-Teams中的聊天室?这是用于单向消息传递:即张贴消息,而不是阅读消息.
How can I automatically post messages to chat rooms in Microsoft-Teams? This is for one-way messaging: i.e. posting messages, not reading messages.
这里的大局是我们正在评估不同的群聊解决方案,其中一项要求是将来自各种服务和服务的错误消息发布到聊天室中.程序.
The big picture here is we are evaluating different Group Chat solutions, and one requirement is to post error messages to chat rooms from various services & programs.
明智的方法似乎是建立身份验证似乎很复杂,即使那样我也无法弄清楚如何仅发布一条消息.我们正在寻找一种可以简单地用于不同脚本语言(Perl,Python,Shell脚本等)的通用解决方案,因此我们不想使用 Node.js SDK .
A sensible approach seems to be to build a Bot using the REST API however just the authentication seems crazy complex, even then I can't work out how to just post a message. We're looking for a general solution that can be used simply in different scripting languages (Perl, Python, shell scripts, etc), so we don't want to use the .NET SDK or Node.js SDK.
我们已经研究了Slack和Cisco Spark.在这两种方法中发布消息都非常简单,因此我希望有一种类似的针对Microsoft团队的简单解决方案?!
We've already looked at Slack and Cisco Spark. Posting messages in both of these is super simple, so I'm hoping there's a similarly simple solution for Microsoft-Teams?!
例如:
在Slack中,您可以使用传入网络钩子来发布消息.您可以使用网络界面为每个聊天室获取唯一的Webhook URL,然后对该URL进行简单的HTTP POST(带有JSON消息有效负载)以
In Slack you can use incoming webhooks to post messages. You use the web interface to get a unique webhook URL for each chat room, and then do simple HTTP POST to that URL (with a JSON message payload) to post to that chat room as the Bot. I had it working in 10 minutes.
在Cisco Spark中,您创建Bot ,该Bot将为您提供唯一的访问令牌.然后,您将获得一个聊天室的room_id,并将其一起用于进行HTTP POST(同样具有JSON有效负载)以在聊天室中创建一条消息.
In Cisco Spark you create a Bot which gives you a unique Access Token. You then get a room_id for the chat room and use those together to do an HTTP POST (again with a JSON payload) to create a message in the chat room.
那么您如何以编程方式将消息发布/创建/发送到Microsoft-Teams中的聊天室?
So how do you programmatically post/create/send messages to a chat room in Microsoft-Teams?
谢谢! 贾斯汀
推荐答案
执行所需操作的最简单方法是使用传入Webhook"连接器将消息发布到频道.有关更多信息,请参见此处:
The simplest way to do what you want is to post a message to a channel using an "Incoming Webhook" connector. For more information, see here: https://msdn.microsoft.com/en-us/microsoft-teams/connectors?f=255&MSPPError=-2147217396#setting-up-a-custom-incoming-webhook
这篇关于自动/批处理消息发布到Microsoft-Teams聊天室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!