简体   繁体   English

在MS Teams中发送主动消息Bot无法正常工作

[英]proactive message sending in MS Teams Bot not working

I created a Bot and added to Skype and Microsoft Teams. 我创建了一个Bot并添加到Skype和Microsoft Teams。 Both are responding fine for user messages (reply to user messages). 两者都对用户消息做出了良好的响应(回复用户消息)。

Following the documentation , I tried to send (ad-hock) proactive messages to users. 文档之后 ,我尝试向用户发送(ad-hock)主动消息。 This worked with Skype but it not with Microsoft Teams. 这适用于Skype,但不适用于Microsoft Teams。 It also did not provide any error messages. 它也没有提供任何错误消息。

Do I have to adjust any settings in Microsoft Teams or Office 365 in order to send proactive messages? 我是否必须调整Microsoft Teams或Office 365中的任何设置才能发送主动消息? Or is there any other specific way to send proactive messages for Microsoft Teams? 或者是否有任何其他特定方式为Microsoft团队发送主动消息?

Figured out what was the error. 弄清楚错误是什么。 Following code line should be added before calling SendToConversationAsync, CreateConversationAsync etc.. 在调用SendToConversationAsync,CreateConversationAsync等之前,应添加以下代码行。

MicrosoftAppCredentials.TrustServiceUrl(ServiceUrl); MicrosoftAppCredentials.TrustServiceUrl(serviceURL中);

And I tested this for documentation and sample source . 我测试了这个文档示例源 Both are working fine. 两者都很好。

The documentation for this is found in this article: Starting a 1:1 conversation . 可以在本文中找到相关文档: 开始1:1对话 There's also some sample source although it's part of a larger project. 虽然它是一个更大的项目的一部分,但也有一些样本来源

See if that helps. 看看是否有帮助。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM