I am quite new to Bot Framework and exploring the solutions.
I am trying to use microsoft bot framework in an android app (and a python flask app after that) as an API call. For this I want to figure out how to send a message to my bot and receive the answer via postman
Right now my bot is up and running on teams and webchat. I am using bot service to make use of the microsoft bot framework. My app is running on Heroku and the bot is hosted on Azure.
I have checked the direct line channel on bot service, but this is returning an iframe for a webchat and i would like instead to send my message programmaticly via python, java, etc as an api call
I have also checked stackoverflow question regarding the v3 bot framework and have tried the following : How to connect my python bot to microsoft bot connector
Send message from Postman to Microsoft Bot
https://pypi.org/project/botframework-connector/
1° I got an access to my bearer token following the second stackoverflow url :
{
"token_type": "Bearer",
"expires_in": 3600,
"ext_expires_in": 3600,
"access_token": "eyJ0eXAiOiJKV1QiL***********************************ObNWg"
}
2° Then providing postman with the bearer token with this url https://directline.botframework.com/v3/directline/conversations/
and this json raw body :
{
"type": "message",
"from": {
"id": "user1"
},
"text": "hello"
}
this is returning :
{
"error": {
"code": "BadArgument",
"message": "Missing token or secret"
}
}
As mentioned I am new to this, so any insights on the above would be greatly appreciated!
Ok nevermind, the answer I was looking is available on this tutorial : https://thewebspark.com/2018/04/15/directlineapi-testing-with-custom-client-and-postman-microsoft-bot-framework/.
It works perfectly on my side.
1) you use your direct line token with Bearer <token>
, using POST request on https://directline.botframework.com/v3/directline/conversations.
you get a new token and a conversation_ID
2)Then you use a GET request on https://directline.botframework.com/v3/directline/conversations/conversation_ID/activities
with your new token as Bearer <token>
and your json body as :
{
"type": "message",
"from": {
"id": "user1"
},
"text": "hello"
}
That's all!