无法在Bot框架中使用DirectLineAPI发送消息 [英] Cant send message using directlineapi in bot framework

查看:151
本文介绍了无法在Bot框架中使用DirectLineAPI发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Directline API进行网络聊天.

I am using directline api for webchat.

生成令牌后,我将在正文中的标题和活动对象中的令牌以及该URL:

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}/活动

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

我得到404页面找不到响应:

I am getting 404 page not found response:

这是我的Activity对象:

Here is my Activity object:

{"type":"message","text":"Testing Directline API",对话":{"id":"conversationId"},收件人":{"id":用户请求ID"},来自":{"id":"mybot id",名称" :我的机器人名称 }}

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

我的请求正文:

{"type":"conversationUpdate","id":"ID",时间戳":"2017-12-23T05:03:45.5925924Z","serviceUrl":"

{"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"}]}

我不知道该如何解决.

推荐答案

获取404页面未找到响应

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

根据我的测试,我怀疑您提供的{conversationID}出现问题,从而导致了问题.请尝试

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.

在测试中,如果我提供的对话ID不正确,我将在提琴手中收到 404 并显示"未知对话"错误消息.

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

这篇关于无法在Bot框架中使用DirectLineAPI发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆