How to make your chatbot multilingual

Image of an author
Sylwia Kocur
6 min read
updated: Nov 13, 2024

The ChatBot platform allows you to communicate with customers all over the world. In this article, you’ll learn how to add a new language to your AI bot. We’ll also show you how to make it work with your LiveChat integration.

This article applies only to the created bot flow.

If you scanned your knowledge sources to create the bot automatically, the sources must be in English. Still, if the answer is within the scanned sources in the AI Knowledge module, the bot will translate the responses to match the user’s message language.

This article applies only to the created bot flow.

If you scanned your knowledge sources to create the bot automatically, the sources must be in English. Still, if the answer is within the scanned sources in the AI Knowledge module, the bot will translate the responses to match the user’s message language.

Setting up a multilingual bot in ChatBotLink icon

  1. Ask users about their language - use the Bot Response block to ask users about their language. In this example, we use the “Welcome and language options” block.
    In this example, we use a Button response with two buttons: English (1) and Spanish (2). Once clicked, each button is set to go to the respective User Input block (3)—English or Spanish (4).

  2. Save the language chosen by the user - once a user clicks a chosen button, one of the related Set attribute blocks is triggered to set the language in your chatbot. Each of the mentioned Set attribute blocks changes the value of the selected_language (1) attribute to English or Spanish (2).

    If the selected_language attribute is not available on the list of attributes to choose; use the +Add custom attribute option once you open the SET dropdown.

  3. Go to “Hello once again!” - when your chatbot sets the language, the flow continues. If the Spanish language is set, the Go to step block brings the bot and the customer back to the main flow. If the English language is set, the flow continues automatically to the “Hello once again!” Bot Response and further on.

  4. “Hello once again!” Bot response - After successfully setting the language, each Bot Response block can be set to display the expected language messages. In the example, the chatbot uses filters to check the value of selected_language. Each response needs to have a filter added to check the value of selected_language.
    Once you set the mentioned filters for your Bot Response messages, your chatbot will always check the selected_language to see what language message it should send.

Automatically detect the website language with JSLink icon

This section applies only to the Chat Widget Legacy. If you use our new Chat Widget, contact us at support@chatbot.com for further instructions.
This section applies only to the Chat Widget Legacy. If you use our new Chat Widget, contact us at support@chatbot.com for further instructions.

If your website has different language versions, you can make your chatbot recognize which one is loaded when a customer starts a chat. It can be done using Chat Widget API and the setSessionAttributes method.

Detect the website language
window.BE_API = window.BE_API || {};
window.BE_API.onLoad = () => {
    window.BE_API.setSessionAttributes({
        selected_lanugage: “English”,
    })
}

For example, if you have two language versions of your website - the English and the Spanish ones: on the English version, you need to add the code with the selected_lanugage: “English” parameter, and on the Spanish one, you need to set selected_lanugage: “Spanish”.

Once you set it, depending on what language version of your website a customer opened, when they started a chat, the chatbot will receive the information about the selected language attribute and if its value is English or Spanish. More about ChatBot Attributes can be found here.

Using the described Chat Widget API method, the process takes place automatically on your website.

Set Filters in your chatbot to make it display English or Spanish messages respectively.

Each of your Bot Responses blocks needs to have two responses - one in English and the other in Spanish. Each one also needs a filter added to check the value of selected_language.

The filter of the English message has to check if the selected_language value equals English. The Spanish message filter has to check if the selected_language value equals Spanish.

Setting up a multilingual bot in ChatBot integrated with LiveChatLink icon

  1. Ask users about their language for chats handled by ChatBot - If you want your chatbot to ask customers what language it should use to chat with them in the LiveChat widget, the configuration is required only on the ChatBot side. Follow the steps in this section of this article.

  2. Make ChatBot use your LiveChat Group language - With LiveChat, you can set a different language for each of your LiveChat Groups. When ChatBot is assigned to a chat in the LiveChat app, it receives the information about the Group in which the chat was started.

    ChatBot saves the Group’s ID number as the default_group_id attribute. Using that attribute, you can filter your chatbot to use the expected language. The LiveChat Group ID can be found in your LiveChat agent application Team section > Groups tab or by following this link. After clicking the chosen group on the list, you can find its ID right below its name in the Details on the right.

    For our example, we created two groups. The “English” group has ID number 213, and the “Spanish” group has ID number 214.
    Within each of the bot responses, we need to add two of them – one in English and the other in Spanish.

    Each response needs to have a filter added to check the value of default_group_id. If once we click Add filter, the default_group_id is not available on the list, we have to choose +Add filter for the custom attribute and add default_group_id there (1).

    The filter of the English message has to check if the default_group_id value equals (2) 213 (our English group ID). The Spanish message filter has to check if  default_group_id equals 214 (our Spanish group ID) (3).

    Once you set the mentioned filters for all of your Bot Response messages, your chatbot will always check the group ID to see what language message it should send. You can always add more languages and related filters if needed.

Read more:

Was this article helpful?

Got it!

Thanks for your feedback.

Thank you!

We’re happy to help.

Start a free ChatBot trial
and build your first chatbot today!

Free 14-day trial No credit card required

Discover our text| products