连接到基于Microsoft Bot Framework的脱机直接路线路由到本地echo bot

时间:2019-08-28 08:21:39

标签: c# asp.net-web-api botframework direct-line-botframework line-messenger

我想使用本地环境中托管的pierre3提供的API包装器来创建Line消息传递机器人。

Line Messaging Service ~~POST~~> WebApi.Net ~X-> Offline-Directline ---> Echobot (Bot Framework)

我正在使用应该进行路由的节点包“ offline-directline” 消息发送到本地bot,该消息是从捆绑在其中的Echobot模板创建的 Microsoft BotFramework扩展。

这是打印在节点终端上的文本:

Offline-Directline: Listening for messages from client on http://127.0.0.1:3000
Routing messages to bot on http://localhost:3978/api/messages

到目前为止,我的webapi能够从Line Messenging Service接收请求。

问题是我不知道如何从webapi连接到offline-directline。

DirectLineClient不会引发异常,但是 每当webapi执行StartConversationAsync()时,对话始终返回null。

我可以确认我的Echobot在工作,因为我可以使用Bot Framework Emulator与之交互。

var uri = new Uri("http://localhost:3978/api/messages");
var cred = new DirectLineClientCredentials(null, http://localhost:3000/directline");
this.dlClient = new DirectLineClient(uri, cred);

var conversation = await dlClient.Conversations.StartConversationAsync();
//this is always return null

我希望通过Line Messenger发送文本“ hello world”时, 该机器人将在Line Messenger上以相同的文本“ hello world”进行响应。

有关其他信息,我不确定是否相关: Line Messaging Api包装程序需要使用Azure Blob存储。 我没有在线Azure Blob存储,而是使用存储模拟器并将连接字符串设置为“ UseDevelopmentStorage = true”。 我认为这是可行的,因为我已经检查了CloudBlobClient的实例不为null,并且它包含指向本地仿真器的有效uri。

-

我已经坚持了好几个小时,却一无所知。 任何帮助将不胜感激。

0 个答案:

没有答案