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.

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.

Determine the user's preferred language

The two solutions presented below go hand-in-hand in determining what's the user favorite language to interact in.

Toggle on Language detection

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.

Collect the user's preferred language

To build a flow that collects the user's preferred language:

  1. Go to your canvas in Flows.

  2. Create a Collect input block.

  3. Inside this block, ask the user in what language they'd like to continue, with buttons corresponding to your bot languages.

  4. For each button, set the preferredLanguage variable with value corresponding to the chosen language code.

  1. Fill the lower part with these info:

  1. Click Save.

Trigger a language with the Web channel

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.

Last updated