Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Microsoft offers great bot development framework (https://dev.botframework.com) for bot developers. The key features are:
The best part, for me at least, is the dialog support. If the bot only does single Q and A, then it is not much different from search experience. But with dialog support, bot remembers previous conversations and use multiple input to execute business logic to achieve something greater.
The issue? Microsoft Bot Framework do not support LINE platform atm.
Solution
Yes, there is a solution. Microsoft Bot Framework have channel called “Direct Line”, which let developer connect whatever they want. So only we need is a connector which uses it. We implement the connector by using C# and it is super easy to set up.
Who want to use this?
There are two types of audience for this solution.
Prerequisites
For LINE developer account and bot setup, please refer to Setup LINE section of my previous article
Setup
Bot Framework
Let’s start from Bot Framework side. I am using sample Pizza bot application for my test here.
1. Go to https://dev.botframework.com and select your registered bot and select “Channels”.
2. Click “Direct Line” in “Add a channel”.
3. Copy one of Secret Keys and click “Done”.
Azure Storage
To track several items, we use Azure Storage.
1. Go to Azure Portal. https://portal.azure.com
2. Create a storage account. I created one in the same resource as my bot application lives.
3. Move to the storage account you created, and click “Access keys”.
4. Copy one of the CONNECTION STRING.
LINE bot
1. Go to LINE Developer portal (https://developers.line.me) and select your LINE bot.
2. Copy Channel Secret.
3. Issue and copy channel access token.
4. Keep the window open as we will update webhook URL later.
Connector
Next, setup connector.
1. Open Visual Studio 2017, go to tools | Extensions and Updates.
2. Search “LINE Bot C# Template from Online and install it. Restart the VS if necessary.
3. From project, select “LineWithBotFrameworkApplication” template and create the project.
4. Open web.config and fill parameters.
5 For NuGet packages, update as you need.
6. Right click the project and click “Publish”.
7. Publish to Azure Web Apps, and copy the URL.
8. Go back to LINE developer portal and update Webhook URL. Do not forget to add “/api/linebot” at the end.
Test the bot
Everything up and running, so let’s test.
1. From your LINE client, add the bot by scanning QR code in LINE developer portal page.
2. send “hi” and then follow it. Oh I just realized that I am not using pizza bot sample but using sandwich sample. Anyway it doesn’t matter much here.
How this works
It’s very simple. The connector receives the message from LINE Platform, and redirect it to Bot Framework via direct line. Then it receives the results back from Bot Framework, then redirect to LINE Platform. It just changes the format in between.
Anyway hope you enjoy hooking your Bot Framework application to LINE
Ken
Please sign in to use this experience.
Sign in