Microsoft Bot Framework DirectLine cannot access conversations

I am trying to use the Microsoft Bot Framework DirectLine API to read and add messages to existing conversations between other users and my bot. From what I read, I believe that this should be possible using the master secret, but it just doesn’t work for me. I use WebAPI to try to access two of my existing conversations (on Facebook and Skype) as follows:

    [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 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() 404 GetMessages(). , , .., Facebook Skype DirectLine API. , DirectLine API, .

, , , : Microsoft Bot Framework

.

+4
1

DirectLine . , ( ), . , - (.. Facebook End User ↔ Your Bot ↔ Facebook Support Person). , . ( Facebook User ↔ Your Bot ↔ Skype) n . , , , , . ,

+1

Source: https://habr.com/ru/post/1660587/


All Articles