Send a message from Postman to Microsoft Bot

I am trying to send a message to a bot that I created and published for azure services so that the bot can start messaging with some of its users.

I try to first execute requests on Postman so that I can then build a controller for this interaction.

I am making the following request:

POST https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
Body:
grant_type:client_credentials
client_id: my_ms_app_id
client_secret: my_ms_app_secret
scope: https://api.botframework.com/.default

from this I get the carrier permission in the response:

{
  "token_type": "Bearer",
  "expires_in": 3599,
  "ext_expires_in": 0,
  "access_token": "eyJ0eXA..."
}

Then I move on to the following query:

POST https://skype.botframework.com/v3/conversations
Content-Type: application/json
Authorization: Bearer eyJ0eXAi....

{
    "bot": {
        "id": "i don't have this id so i pass some string",
        "name": "connector controller"
    },
    "isGroup": false,
    "members": [
        {
            "id": "28:...", //ID of the bot I want to send the message to
            "name": "Sp Bot"//Name of the bot I want to talk to
        },
       {
            "id": "i don't have this id so i pass some string",
            "name": "connector controller"
        }
    ],
    "topicName": "News Alert"
}

In response, I get a conversation identifier that matches "id": "I do not have this identifier, so I pass some string": {"id": "I do not have this id, so I pass some string"}

Then I move on to the following POST request:

POST. https://skype.botframework.com/v3/conversations/i don't have this id so i pass some string/activities
Authorization: Bearer eyJ0...
Content-Type:application/json

I get the following answer:

400 Bad Request

{
  "error": {
    "code": "ServiceError",
    "message": "The conversationId 29... and bot .... doesn't match a known conversation"
  }
}

, . , https://skype.botframework.com/v3/conversations .

, : https://skype.botframework.com/v3/conversations/.../activities serviceError.

+4
2

"/", .

Direct Line, , , .

, , # Node.

, , , Direct Line :

C#

Node.js

" ".

+6

, , , DirectLine , , screencaps DirectLine Potsman. , , Postman, Postman . , DirectLine v3.0 .

, , {{DLsecret}} guts : Bearer <your-dl-secret>:  Call # 1 Header

, : Call # 1 Answer body

, , , (vs four), , , conversationId : Challenge # 1 Tests and Results

, : Call # 2 headers

, : Call # 2 Request body (message)

: Call # 3 Answer body

+4

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


All Articles