Create a multilingual bot

Create a multilingual bot

Would you like your bot to speak the language a user chosen? Here we exlain to you how to set it up.

The important thing is that there is no right or wrong here. Many ways lead to the goal! Today, however, we want to look at the language setting about topics! The concept is not overly complicated: the bot greets the user, asks to pick a preferred language and  continues the conversation in the selected language.

Even the implementation is quite simple. It takes just 8 steps:

  1. Create topics for the language selection and the desired languages

2. Create a welcome dialogue in the topic “default” following by a request to choose a language that will be send to the user  at the beginning of their conversation.

The “ _start” is the special expression for sending a welcome message to the user as soon as he interacts with the chatbot for the first time. Make sure to change the topic from here, taking the conversation to “Select language”. This is how it can look like, for example:

3. Create a language selection question in the field “Chat by activation” of the topic “Select laguage”. 

This is how it could look like. Adding the languages as a button at the bottom is of course optional, but it makes it easier for the end user to use, and that is our goal. 😊 Here you could also point out to a general command, e.g. “language” , “Sprache” or “lingua”, that can be used anytime to change the language setting.

4. Go to “Variables” and create a new variable there, where you store the user’s language.

By storing the user’s language in a variable, we don’t have to bug returning users with language selection every time!

5. Now integrate possible user answers under the language query.

Using special syntax (e.g. $language=”english”$) you can set the value of the variable $language$ to the language selected by a user. This syntax won’t be shown to the user, in our example the bot will simply set the value and switch the topic to “English” proceeding there.

In the last User Question, the asterisk is a so-called “wildcard“, which means that if anything other than the expected languages is entered, we let the user know that he should limit himself to the specified languages. This looks like this from within the block:

6. Create a command for changing language preferences

So that the user can always change his language, integrate  “Language”/”Sprache”/”Lingua” command under the topic “Priority”. Thus, no matter from which topic, one always has access to it:

7. Continue setting up the bot for the selected languages

Now you can let your imagination run wild and set up new user questions for the bot, e.g.:

8. Direct returning users to their language

Returning users naturally start at the beginning again, so we need to look at the “default” topic here.

The _start dialog is no longer triggered, it is only for new users. So now the “wildcard” comes into play again. When the asterisk is triggered, we want to send the user to his language:

Here we call the variable “language” stored during the language selection. In the condition we can then, depending on which language the user has selected, redirect him to the correct topic for his language:

Your bot can now communicate in several languages and read to go live!