Bots for Business

A Guide to Building Bots for LINE Messaging App

LINE is one of the most popular messaging apps across Asia. LINE offers bot developers a robust API, multiple SDKs, and straightforward integrations.

June 25, 2019
line messaging app and tools to build a chatbot

 

LINE is one of the most popular messaging applications in Asia. In fact, in certain Asian markets (Japan, Taiwan and Thailand), it’s the messaging app, and its medley of stickers and social games is a major part of the LINE experience.

Unsurprisingly, chatbots facilitate many of the actions, social and otherwise, taken by LINE users. But how do you build a LINE bot, and what’s involved in making one? For that matter, why should you build a bot for LINE instead of another messaging application?

Let’s take a look at what’s involved in making a chatbot for LINE. We also explore a few chatbot examples, including some outside-the-box LINE bots that go well beyond mere sticker-buying.

Why build a LINE bot?

In Japan, the LINE messaging app is practically a way of life. Around 78 million users (Japan’s population is about 127 million) across all age groups use the app to keep in touch, entertain themselves with games, make purchases, and even seek employment. LINE is also extremely popular in Thailand and Indonesia. If you’re targeting bot users in these markets, it almost goes without saying that you’ll deploy your bot to LINE.

Since social games are particularly popular among LINE users, you might do well to deploy your gaming bot to LINE. Compared to messaging apps for which the primary purpose is, well, messaging (such as WhatsApp), a gaming bot may stand a better chance of gaining traction on LINE.

At the time of this writing, LINE is starting to invest in financial services and payments. If your bot facilitates e-commerce or does anything specifically related to payments, keep an eye on what LINE is up to. The platform may soon become fertile territory for your payments chatbot.

How to make a LINE bot

No matter how or where you build your bot, you’ll use the LINE Messaging API to connect to the channel and communicate with users through text messages, sticker messages, image messages, and more. When you deploy your bot to LINE, you’re essentially operating a standard LINE account, only in “bot mode.”

The API transmits data between the server where your bot is hosted and LINE. Users send a message to your bot’s LINE account. LINE then sends a webhook event to your bot server, which transmits a response according to the definitions you established for your bot’s behavior.

Messaging API SDKs

A relatively quick way to build a bot for LINE is to use one of several Messaging API SDKs. They’re available on GitHub in the following languages:

Choose your preferred language, and take advantage of all the included libraries and samples. Of course, these SDKs only accelerate the development of bots specific to LINE. If you’re building bots for multiple channels or you want some additional features or functionality, consider building your bot on a third-party framework.

Chatbot frameworks

So, which framework should you use to build a LINE bot? Technically, you can use any framework you want. However, if you’re not already working with a specific framework and you know you want to deploy your bot to LINE, consider using Microsoft Bot Framework (with Azure Bot Service) or Dialogflow, both of which offer very straightforward LINE integration.

We run through the Microsoft Bot Framework and Dialogflow integration processes in a subsequent section of this article, but they basically amount to verifying some credentials on the LINE end and on the framework end.

One benefit to using a true bot framework is access to robust natural language processing (NLP) tools that help your bot interpret user intent. Frameworks like Dialogflow, Microsoft Bot Framework, Wit.ai, and Amazon Lex come loaded with some of the industry’s most advanced NLP capabilities.

Another reason to build your bot with a framework is the ability to deploy it across platforms, including messaging apps, websites, social channels, and even your own mobile or web app. In other words, you’re not committed to having a bot just for LINE.

When you know you’re going to deploy your bot on multiple platforms, it’s a good idea to give it a “forever” home so that users can find it without using a specific messaging app. A .BOT domain name is well suited to this purpose because it’s easy for users to remember yourbotsname.bot. In many cases, it’s easier to navigate to a dedicated domain than to launch an app and find your bot. All users have to do is bookmark it!

GUI bot development

For non-developers or anyone who wants to quickly prototype a LINE-specific bot, LINE Bot Designer offers a graphical user interface (GUI) for creating a chatbot. It’s a template-based design experience. You choose different, prebuilt message types to construct a chatbot that reacts appropriately to certain types of user inputs.

The neat thing about LINE Bot Designer is that it generates JSON code as you build out your bot. That way, a non-developer who understands the business case for a chatbot can prototype something and send it out to developers for further refinement. Through LINE Bot Designer people with varying skill sets can collaborate across business units to build capable, communicative chatbots.

How to integrate your bot with LINE

If you’re using one of the frameworks with a dedicated integration module, the process is simple. Dialogflow documentation contains all the instructions for integrating your bot with LINE. The basic steps follow:

  1. Create a LINE bot via the LINE Messaging API.
  2. Set up Dialogflow by copying the webhook URL.
  3. Go to your LINE account, enable webhooks, and add the URL.
  4. Copy and paste data specific to your LINE account into the Dialogflow integration area.

In a nutshell, you verify essential credentials on the LINE end and on the Dialogflow end, and voila, your bot is live!

The process for Microsoft Bot Framework is virtually identical. Documentation for each of these frameworks advises you to test your bot and outlines how to do that via the LINE developer console.

Using a different framework? This Amazon Lex tutorial shows you how to integrate a Lex bot with any messaging application. Basically, you need to put a serverless middle layer between your bot and LINE. If you’re using Lex, AWS Lambda can fulfill this role. Another option is to use Twilio, which integrates with LINE (and with practically every bot framework) and which provides a single API for deploying your bot on various channels across the web.

LINE messaging chatbot examples

LINE bots skew toward social gaming and entertainment. However, with practically every age demographic in LINE’s biggest market (even those who presumably don’t spend much time gaming) glued to LINE, there’s no shortage of practical purposes for your LINE chatbot.

Entertainment and gaming chatbots

LINE is a social gamer’s paradise. Among the numerous choices is Kweri, a bot that asks you simple yes/no questions and scores your responses. There’s also Erwin, which sends you riddles to solve, and the Rorschach Test bot, which shows you inkblots to provide insights into your personality.

Shopping chatbots

Using the Fufilo bot, which is equal parts shopping assistant and shipping mediator, LINE users in Asian countries can look up the prices and availability of certain US products. They can also get shipping information and even order the products directly.

Another popular LINE shopping bot is Rewardy, which rewards users for interacting with ads. When using this bot, you’re exposed to ads on LINE and prompted to respond with some sort of action. The bot rewards you for your time, with gift cards from various retailers.

Customer service chatbots

If you’re wondering whether LINE bots do anything practical, look no further than Lifenet. The Lifenet LINE app, which is essentially an automated reply bot, helps users shop for insurance policies based on information they provide.

Another service-related LINE bot is &HAND, which helps connect users who have disabilities with qualified caregivers. As the winner of the 2017 LINE BOT AWARDS, &HAND may well be the best LINE bot for improving the day-to-day lives of users.

Getting started with LINE bots

A good place to start is the LINE Messaging API documentation. This information explains how your bot will interact with users on the platform. If you just want to prototype a quick bot to get a feel for the LINE development ecosystem, consider playing around with LINE Bot Designer. Remember, it auto-generates JSON code that you can later use in a “real” development session.

Other than that, the best way to get started is just to start! Create a channel for your bot and build it. Or, if your bot is already built, go ahead and deploy it to LINE. In most cases, the process is fairly simple, and there are lots of potential LINE users to engage.

Leave a Reply

Your email address will not be published. Required fields are marked *