AI-powered LINE Customer Service Bot: Training Secrets Revealed!

In a previous article, I mentioned using an AI bot service called Chatbase. Recently, I finally integrated it into my LINE Official Account, and it’s been working quite well. Additionally, I developed a WordPress plugin to integrate with the Chatbase API, along with some mechanisms to fit my business logic. At the end of this article, I’ve included the plugin download link and usage instructions.

Introduction to Chatbase

Chatbase is a customer service bot that integrates with the OpenAI API, allowing a chat window on your own website where potential customers can make inquiries directly. For website operators, it helps reduce the costs associated with developing a chat interface and connecting APIs, enabling them to quickly address customer questions with a bot.

Although, as a developer, I could create my own solution, training was a headache. The process involves preparing training data, converting it into JSON format, and then uploading and testing the fine-tuned model, not to mention the associated costs of training time. Currently, my website has only around 200 articles, but just thinking about organizing them feels exhausting.

After evaluating, I decided to let Chatbase handle it for me. Its training interface is well-designed, supporting five formats, so I can just click a few options to upload training data. Moreover, the model training doesn’t incur additional costs. Using their service allows me to save on the following:

  • Reducing the time needed to answer customer inquiries
  • Costs of developing a chat interface
  • Time spent organizing training data
  • OpenAI API usage fees

These four reasons led me to decide to subscribe to Chatbase.


Chatbase Pricing Model

There are four pricing plans in total, and I am using the $19 per month plan, which includes:

  • 2,000 message replies per month
  • 11 million characters for training data
  • API access

Currently, my monthly message volume is low, around 100 messages, and I’ve trained about 1 million characters, utilizing approximately 10% of the allowance. Higher-tier plans provide larger monthly message limits, and you can purchase additional usage as needed. You can buy an extra 1,000 messages for a one-time fee of $9 or subscribe to an additional 1,000 messages per month for $7, which is convenient for any unexpected surges.

View Chatbase’s pricing plans

https://www.chatbase.co/pricing?via=oberon

Solutions I’ve Tried

The reason I wanted to find a customer service bot was to reduce the workload of live support—meaning, my own work. To achieve this, I started organizing product documentation and compiling an FAQ from frequently asked questions so that customers with similar needs could find answers without waiting for my response.

So, I first looked for a WordPress plugin that could create a knowledge base. Around that time, weDocs by weDevs was newly launched, and I noticed it had an integrated customer service bot, solving two problems at once. Its backend interface was well-designed and quite user-friendly for writing documentation. However, I repeatedly failed to activate the bot service.

Additionally, the backend interface had issues: even after I had subscribed to the bot, it reverted to showing as unsubscribed. Thinking the subscription hadn’t gone through, I ended up subscribing four times. Customer support was also slow and often unhelpful, so it took two months of back-and-forth before I could finally stop the charges. In the end, I only used weDocs for its documentation functionality.

I also tried another service, DocBot, which costs $19 per month but requires my own OpenAI Key. At one point, I didn’t realize my account was out of credits, so customer inquiries went unanswered. Furthermore, the basic plan didn’t allow me to view the full chat history, so I decided not to continue using it.

Customer Service Bot Integration Workflow

I positioned the customer service bot as a more flexible in-site search interface to replace traditional search functionality. I want customers to find answers without clicking through multiple links and instead be able to ask questions naturally. This approach also helps potential customers learn more about the product, ultimately driving sales.

Since LINE is widely used in Taiwan, and Chatbase’s chat interface has issues with Chinese input, I leveraged Chatbase’s API to retrieve bot responses through LINE’s Webhook, delivering them directly to customers.

You can test this setup by joining our official LINE account: https://page.line.me/vrf7844t?oat_content=url&openQrModal=true

Here’s how the process works:

  1. The customer sends a message to the LINE Official Account
  2. LINE forwards the message content to the website https://oberonlai.blog via Webhook
  3. The website calls Chatbase’s API to get the response
  4. The website returns the response to the LINE Official Account

The receiving and sending website doesn’t have to be on WordPress, but since I’m using it, I developed a plugin to handle this workflow. Here’s what I configured:

  • Add “I am a bot” to the beginning of each response so customers know the reply is from a bot, not a human.
  • Notify me if a customer’s message contains specific keywords, along with the AI response, so I can step in if needed, increasing the chances of successful sales.
  • Notify me if the answer isn’t in my knowledge base, including the customer’s question and AI response, so I can expand the knowledge base.

For Chatbase’s bot, I set a default prompt as follows:

“I want you to act as a customer service bot and a WordPress expert. Your name is ‘Xiao Ou.’ You will provide answers from the given information. If the answer is not included, respond on your own or use web searching and add the comment ‘(This answer is generated by AI, not provided by the site. For reference only.)’ at the end of your response. Never break character. Reply in the language the user used.”

With this setup, I’ve created a customizable and self-training LINE customer service bot.

Chatbase API document

https://docs.chatbase.co/docs/getting-started?via=oberon

Setting Up the LINE Customer Service Bot Plugin

If you’re using WordPress, you can download this plugin:

Download WordPress LINE AI Bot Plugin

You’ll need to prepare the following six pieces of information:

  1. LINE Messaging API access token
  2. LINE Messaging API secret
  3. Chatbase bot ID
  4. Chatbase token
  5. URL for submitting training data to Chatbase

6. Email address for receiving correction notifications

You can refer to this article for the first two items. For the third item, log in to the Chatbase interface, select the specific bot, and find it on its settings page.


The fourth item is to add a new API Key in the account settings interface of Chatbase.


The fifth item is a link that will appear in the email notifications. I linked it directly to the knowledge base input area. After obtaining the above information, open the following file: wp-content/dwp-line-bot/src/Api.php and fill in the corresponding attributes with the data mentioned above.

private static $channel_access_token = ''; // LINE Messaging API access token.
private static $channel_secret       = ''; // LINE Messaging API secret.
private static $chatbase_bot_id      = ''; // Chatbase bot id.
private static $chatbase_token       = ''; // Chatbase api key.
private static $chatbase_source      = ''; // Chatbase url of providing source.
private static $email                = ''; // The email of receiving bot notifications. 

After making the modifications, save and upload the file. Next, set the Webhook of the LINE Official Account to the API path of your website. Go to the LINE Developers console, find Webhook settings, and set the Webhook URL to:

https://yoursite.com/wp-json/dwp/v1/webhook

Replace yoursite.com with your website’s URL. This will allow Chatbase’s response results to be sent directly to LINE.

If you want to handle responses manually, remember to turn off the “Use webhook” setting to prevent replies from being sent through the Chatbase API.

In line 143 of the Api.php file, there is a condition set to trigger a correction notification email. Currently, it’s set to notify me when the question contains product-related keywords like “line” or “ordernotify” and when the reply contains AI-generated text. You can modify this based on your needs.

Areas for Improvement in Chatbase

Firstly, the chat window has an issue with using the Zhuyin input method (Bopomofo) as it doesn’t allow character selection; pressing Enter immediately sends the message. Additionally, when training data involves URLs, they must be pasted individually, whereas other tools like DocsBot can directly import XML, which is much more convenient for sites with large amounts of content.

It would also be great if training content could be submitted via API, allowing automatic submissions after publishing new articles or updating data through third-party software. Currently, everything still has to be done manually. Lastly, a significant drawback is that responses generated through the API don’t appear in the backend, making the analytics reports ineffective.

Overall, combining Chatbase with LINE meets my current needs, but I might consider other solutions if the following situations arise:

  • Usage exceeds the current plan, requiring additional monthly purchases
  • Increase in monthly subscription fees
  • Reduction in service limits
  • Removal of OpenAI API usage credits

The customer service bot market is highly competitive; I hope Chatbase can stay strong!

Sign Up for Chatbase

https://www.chatbase.co/auth/signup?via=oberon

Leave a Comment