MS Bot, straight line API, cannot send activity, how to fix it?

I tried to configure MS Bot in the application. So far I have been doing the following.

  • set the REST endpoint for the bot, this connector listens to it.

     app.post("/botapi/messages", connector);
    
  • get APP_ID and APP_PASSWORD, the emulator is successfully connected to the next one,

     http://localhost:4000/botapi/messages
     APP_ID
     APP_PASSWORD
    

    This is successful, the bot responded as expected.

  • Tried to talk to Bot using the Direct Line API. Conversations began successfully. One answer is as follows.

     {
       "conversationId": "3JYZyAn5VYB3HNcO3tcgtn",
       token: ....
        .....
      }
    

    I used node-fetch packages to issue a POST request as indicated in the docs.

However, I cannot submit the action using the Direct Line API, having received

    internal server error 500

The documentation states that the POST request should look like this.

    POST 
    https://directline.botframework.com/v3/directline/conversations
    Authorization: Bearer my_secret

This worked great for starting conversations, but not for sending actions.

I sent the following operation:

      {
       "type": "message",
       "from": {
              "id": "user1"
               },
            "text": "hello Bot, say something"
       }

, "id" - - ,

          https://directline.botframework.com/v3/directline/conversations/{conversationId}/activities

, . googled , . , , , .

Q1: URL- " https://directline.botframework.com/v3/directline/" , Direct Line API? , http://localhost:3000/botapi/messages/conversations", , .

Q2: API ? POST API, API ? API? - ?

Q3: POST , . , , , . , . ?

Q4: - Bot Connector? , , . ?

, ? ?

. azuri aws, Mac. , , APP_ID, APP_PASSWORD SECRET DirectLine.

+4
1

, () Direct Line:

https://directline.botframework.com/v3/directline/conversations/{conversationId}/activities

URI {conversationId} - (conversationId), , . , :

{
    "type": "message",
    "from": {
        "id": "user1"
    },
    "text": "hello"
}

, :

  • Q1: URI Direct Line API.

  • Q2: , Authorization , ,

  • Q3: , , token, Authorization > . , , , , .

  • Q4: , , API . ( @EzequielJadib, Direct Line .)

+2

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


All Articles