2

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.

hollen9
  • 77
  • 9
  • AFAIK To make the Line bot replay to messages , you need to send a `REPLAY_MESSAGE` which is an HTTP request to the line API to `https://api.line.me/v2/bot/message/reply` but first you will need to grab the `replyToken` of the message sent to you in the webhook , [here](https://stackoverflow.com/a/57650422/5407848) I made a working example but with PHP, scroll down to the Line part of the answer, it could give ideas. – Accountant م Aug 28 '19 at 17:32
  • I already made a working Line bot without using Microsoft Bot Framework. The problem I am having is "directline" part, which is an issue related to Bot Framework, but hey, thanks for the info anyway! :) – hollen9 Aug 29 '19 at 05:59
  • A few questions: Are you certain offline-directline is generating a token for you? Have you configured any other settings besides "UseDevelopmentStorage"? Is that setting for Storage Emulator or something else? Are the connection strings, etc., fully represented in your Line Wrapper? – Steven Kanberg Aug 29 '19 at 15:55

0 Answers0