In Focus

Connect Conversational Bot To Line App Using Azure Bot

In this article, we will learn how to connect our conversational bot to the Line app using Azure Bot framework.

Introduction

A Bot application runs inside an application on different channels, like Cortana, Skype, web chat, Facebook, Message, etc. Users can interact with bots by sending them messages, commands, and inline requests. Microsoft has recently announced Line App, a new channel added into the Azure portal.

LINE is a new communication app which allows you to make FREE voice calls and send FREE messages whenever and wherever you are. Line is available in different devices like iPhone, Android, Windows Phone, BlackBerry, and Nokia and even your PC and it has become a popular messaging app with hundreds of millions of users in India, Japan, Taiwan, Thailand, Indonesia, and other countries. You can follow the below steps to create an FAQ Bot and enable your bot in the Line new channel.

Connect Conversational Bot To Line App Using Azure Bot
 

Create FAQ Bot Application

You can refer to my previous article to create and build a Xamarin FAQ Bot using Azure Bot Service and deploy it into Azure. I am not using any coding for developing the Bot Application. You can follow the provided steps in the article to create and deploy FAQ Bot.

Connect Conversational Bot To Line App Using Azure Bot

Line Developer Portal

We can implement a bot application to the Line app. You can create a Line developer account or select an existing provider name. Create a new Line Developer App on the page and generate a Channel Secret and Channel Access Token for integrating the bot to the Line app. You can start by login or create an account in the following screen.

Connect Conversational Bot To Line App Using Azure Bot

Create a Provider

After logging in, create a provider name for your bot; or if you already have the provider, select the provider name and do the setup. The provider can be an individual owner or company, it’s not the app name. Next, click on "Confirm". If you want to change it in the future, the Edit option is always available.

Connect Conversational Bot To Line App Using Azure Bot

Line Messaging API Channel

Create a new Line App on the developer portal and generate a Channel Secret and Channel Access Token integrating the bot to the page messenger. You can click on the “Message API Create Channel” from the following screen.

Connect Conversational Bot To Line App Using Azure Bot

Create a New Channel

The following is the "create new channel" screen. Here, please provide a valid app icon.

Connect Conversational Bot To Line App Using Azure Bot

You can fill in the required fields and confirm your channel settings. You will find two developer options available.

  • Developer trial - A trial plan which lets you create a bot that can send push messages and can have up to 50 friends.
  • Free - A plan which lets you create a bot with an unlimited number of friends. Push message cannot be sent with this plan.

Connect Conversational Bot To Line App Using Azure Bot

Once you've confirmed your channel settings, you'll be navigated to the following screen which lists all the apps.
 
Connect Conversational Bot To Line App Using Azure Bot

Click on the channel you created to access your channel settings and scroll down to find the basic information > channel secret.

You can save the following somewhere for a moment for updating into Azure portal.

  1. Channel Secret – Copy the secret code. If not available, click on Issue.
  2. Channel access Token - Scroll farther to Messaging settings. There, you will see a Channel access token field, with a click on issue button for getting your access token.
  3. Webhook URL - Copy Webhook URL from Azure Portal and update in the Line app developer portal

    Connect Conversational Bot To Line App Using Azure Bot

Connect New Line Channel

Login to Azure portal > Select the “All Resources” > Select your Bot Application > Select Channels property > Find and Select New Line icon. Let us start to configure the “Line “Channel and follow the below steps. At the end of this article you will be able to deploy the Bot into the Line apps.

Connect Conversational Bot To Line App Using Azure Bot

The Azure Line configuration channel will generate the following Webhook URL and paste/update the channel secret and access token and click the Save button. You can copy the following custom webhook URL and Return to the Line Developer portal and update the webhook URL.

Connect Conversational Bot To Line App Using Azure Bot
 

Test Your Bot

Once you have completed all the above steps, your bot will be successfully configured to communicate with users on Line and is ready to test.

  • Line developer console - Navigate to the settings page and you will see a QR code of your bot.
  • Mobile Line app - go to the right most navigation tab with three dots [...] and tap on the QR code icon.

    Connect Conversational Bot To Line App Using Azure Bot

Live Demo

The Xamarin Developer Interview Questions and Answers Bot is ready to use in the Line app. Xamarin FAQ Bot will be ready with 7000+ more Xamarin QnA’s. Now, you can start open your Line App and click on the dotted line. Then, scan the following QR Code to add Xamarin QA bot as a friend.

Connect Conversational Bot To Line App Using Azure Bot
 

Summary

In this article, you have learned how to integrate a bot application into the Line App via Azure Microsoft AI. In case your bot is not responding to any of your messages at all, navigate to your bot in the Azure portal, and choose Test in Web Chat. If you have any questions/ feedback/ issues, please write in the comment box.