How to create a multilingual bot
When a website has visitors who speak different languages it is best to add the Multilanguage option that will translate the texts of the widget (you can read about it here). In order to have the bots showing in more than one language, a bot detecting the language of the visitors’ browser will have to be created.
Such bot needs to have a condition ‘Language’ after its trigger and before the rest of the content of the bot. This article will show, how to create such bot by editing the ‘First Visit on Site’ triggered bot with the welcome message. This tutorial can be used for every bot just as long as the condition is added and the paths for separate languages are there.
This is how the bot is structured when it shows a message in just one language:
Now, in order to insert the condition Language detecting the language of the incoming visitor’s browser, the arrow connecting the trigger node with the ‘Send a Chat Message’ will have to be removed. In order to remove it, hover over the line until you see an X appear and then click on it. Then, inside the panel with all the nodes find Conditions and the Language, here is what the node looks like:
After selecting it, drag it over to the editing grid and connect it with an arrow going from the trigger node to the condition ‘Language’. Here is how to connect them with each other:
Then once they are connected, it’s time to adjust the condition ‘Language’ node. By now, you have probably realized that the node says yes or no on arrows coming away from it. This is due to its customary setup. After clicking on the node, it will present options of choosing if it should be Equal/Not Equal and allowing you to pick the language of the list. I have my message in English so I set the node to ‘Equal’ to English and then point the ‘yes’ arrow towards English.
Now, since I want all the other visitors to get the message in Polish. The ‘no’ arrow (the one directing towards the visitors whose language isn’t ‘equal to English’) will go to the other ‘Send a Chat Message’ node with the welcome message in Polish. So choose Actions and then drag the ‘Send a Chat Message’ into the editing grid. Then once it is there, connect it with the ‘no’ arrow from the condition ‘Language like this:
Once the nodes are connected, write the content of the message in the second language and the bot is good to be saved and published on the site.
If the bot should have longer paths, have more actions, those can be added to each ‘Send a Chat Message’ nodes the only important thing is that if the bot should have the same path for both languages the nodes will have to be added to both paths. This will ensure that visitors of both options will receive the same paths, the only difference will be that they will be translated.