hollen9
hollen9

Reputation: 87

Connect to offline directline routing to local echo bot based on Microsoft Bot Framework

I want to create a Line messaging bot using API wrapper provided by pierre3 hosted on local environment.

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

I am using the node package "offline-directline" which should enable to route messages to the local bot, created from Echobot template bundled in Microsoft BotFramework Extension.

This is the text printed on the node terminal:

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

So far, my webapi is able to receive the request from Line Messenging Service.

The problem is I don't know how to connect from webapi to the offline-directline.

DirectLineClient doesnt throw exception, but whenever the webapi execute StartConversationAsync(), the conversation always return null.

I can confirm my Echobot is working, because I can interact with it using 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

I expect when I send the text "hello world" via Line Messenger, the bot will respond with the same text "hello world" on Line Messenger.

And for extra information, I am not sure this is relevant or not: the Line Messaging Api Wrapper require to use Azure blob storage. I don't have a online Azure Blob Storage, instead I am using Storage Emulator and set the connection string to "UseDevelopmentStorage=true". I assume this is working because I have checked the instance of CloudBlobClient is not null and it contains the valid uri pointing to local emulator.

--

I have stuck on this for many hours yet having no clue. Any help would be much appreciated.

Upvotes: 2

Views: 508

Answers (0)

Related Questions