Determine the user's preferred language
If you have built your bot to support multiple languages, you want it to talk to the user in their own language.
Last updated
If you have built your bot to support multiple languages, you want it to talk to the user in their own language.
Last updated
A bot that doesn't have any information about the user's language will automatically use the primary language. The active language inside the conversation can be changed inside the flow.
Please note that the bot can't figure out the language based on what the user is saying. What the bot can do instead is using the channel information. On Facebook, for example, the bot will use the value it receives from the FB user API. For the web widget, it'll use the SDK language.
The two solutions presented below go hand-in-hand in determining what's the user favorite language to interact in.
You can use Language detection to check if the user's language is supported by your bot. If your bot doesn't support the user's language, redirect language detection to a block that collects the user language.
To build a flow that collects the user's preferred language:
Go to your canvas in Flows.
Create a Collect input block.
Inside this block, ask the user in what language they'd like to continue, with buttons corresponding to your bot languages.
For each button, set the preferredLanguage
variable with value corresponding to the chosen language code.
Fill the lower part with these info:
Click Save.
In the web widget you can trigger a specific bot language based on the language of the page the user is looking at. Find more information on this here.