Cant send message using directlineapi in bot framework

核能气质少年 提交于 2019-12-25 00:15:39

问题


I am using directline api for webchat.

After generating token, Along with that token in the header and activity object in the body I am requesting to this url:

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

I am getting 404 page not found response:

Here is my Activity object:

{"type":"message","text":"Testing Directline API","conversation":{"id":"conversationId"},"recipient":{"id":"User request id"},"from":{"id":"mybot id","name":"My Bot Name "}}

My Request body:

{"type":"conversationUpdate","id":"ID","timestamp":"2017-12-23T05:03:45.5925924Z","serviceUrl":"https://directline.botframework.com/","channelId":"webchat","from":{"id":"FROMID"},"conversation":{"id":"conversationid"},"recipient":{"id":"mybotid","name":"Bot Name"},"membersAdded":[{"id":"mybotid","name":"Bot name"}]}

I don't know how to fix that.


回答1:


getting 404 page not found response

If you’d like to send an activity to the bot, the API that you are using seems ok.

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

Based on my test, I suspect something wrong with {conversationID} that you provided, which causes the issue. Please try to open a new conversation and use the returned conversation id to send activity and check if it works fine.

In my test, if I provide an incorrect conversation id, I will get 404 with “Unknown conversation” error message in fiddler.



来源:https://stackoverflow.com/questions/47949929/cant-send-message-using-directlineapi-in-bot-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!