我正在尝试使用Microsoft Bot Framework DirectLine API来读取和添加消息到其他用户和我的机器人之间的现有对话.从我所读到的内容来看,我相信在使用主秘密时这应该是可能的,但它不适合我.我正在使用WebAPI尝试访问我现有的两个对话(在Facebook和Skype上),如下所示:
[HttpPost] [Route("remind")] public string Remind() { var secret = System.Configuration.ConfigurationManager.AppSettings["secret"]; var uri = new Uri("https://directline.botframework.com/"); var creds = new DirectLineClientCredentials(secret); DirectLineClient client = new DirectLineClient(uri,creds); Conversations convs = new Conversations(client); var conversationIDs = new string[] { "0000000000000000-0000000000000000","00:0123456789abcdefghijklmnopqrstuvwxyz0123456789-A-_0123456798ABCDEF" }; // Existing Facebook & Skype conversations // Send a message to each conversation: foreach (var conversationID in conversationIDs) { Message message = new Message(conversationId: conversationID,fromProperty: "My Bot",text: "hey dude,remember that thing!"); Console.WriteLine(message.Text); convs.PostMessage(conversationID,message); // FAILS - This executes but doesn't do anything. } // Try reading the messages from a conversation (just to test if it's working): string waterMark = null; var set = convs.GetMessages(conversationIDs[0],waterMark); // FAILS - This fails with a 404 not found. waterMark = set.Watermark; return "Done :-)"; }
它无法以静默方式调用PostMessage(),并因GetMessages()而失败.我似乎正在做正确的事情,机器人是现场等在Facebook和& Skype与DirectLine API分开.它只有在我使用DirectLine API创建新会话时才有效,然后我可以访问其消息并向其发布新消息.
这个问题有点帮助,但并不能告诉我如何解决它:@H_404_14@Difficulty accessing messages in an existing conversation in Microsoft Bot Framework
任何帮助将非常感激.
谢谢
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。