Language detection is the task of automatically identifying the language the user is speaking so the bot can respond in the same language - This is something that really does elevate the customer experience with the bot. Language detection is the secret sauce for our Multilingual Bot and can identify 109 languages.
This article covers:
- What you need to know
- CRM Language Detection Set-up
- Language Detection Considerations
- Resetting Language Value
- Welcome Message with Language Selection
- Setting up a Welcome Reply for Zendesk Chat
What you need to know
Multilingual bots require a language to be identified and a reply in that respective language for each of the conversations.
The language is being stored in Conversation Data under the parameter active_language. This parameter can be changed by using actions at any time during the conversation. Language detection will be triggered every time the active_language parameter is empty - this will happen on the first message or if a language has not been saved/ has been reset.
How can bots identify the language?
- from the CRM
- using language detection based on the last customer messages
This is a choice you need to make as to how you want to identify the language of a user. Where do you get the information from, your CRM system, or by analyzing the text the user sends in the first message and making an assignment?
There is a 3rd option where you ask the users in the first message with buttons which language they would like to speak to do the assignment that way. But let's work with the first two for now.
CRM Language Detection Set-up
To ensure the right reply in the right language is used, make sure you have the two things below set up:
- Action to obtain user locale
- Set locale info
Action to obtain user locale
This is to obtain the locale info from your CRM and it varies depending on the CRM platform.
When creating the action, define the Save As field as "active_language"
Zendesk Chat: Get tag
- Zendesk Workspace - Not supported out of the box - it needs to be hardcoded into the widget
Sunshine: Get user
Salesforce: Copy from transcript
Livechat/Freshchat: Not supported
For Zendesk Chat clients, you can also use Get Visitor Info > current_country, but we do not love this approach, as a user location may not represent spoken language. Therefore we'd recommend adding an action in Zendesk Chat and adding a tag based on the URL or a customer-assigned setting, then setting an action to get that tag instead of the current country.
Set locale info
Make sure locale info of the languages is filled out. This can be added when adding a language, or later by going to Bot Settings > Languages. Enter the information that’s the same as the CRM (as you would for reply variations). e.g. DE or Germany.
Language Detection Considerations
If you don't want to use data from your CRM and instead identify the language based on the first message, we use language detection to assign locale info to the conversation. As an AI platform, we leverage Natural Language Processing to identify the language written. Language Detection has the added benefit of using the customers' communication to respond to them natively in the language they are writing in and not need to ask them which language they want to speak so you can get down to resolving inquiries faster.
There are some things to bear in mind:
Language detection works best on messages longer than 5 words to accurately identify the language written. For this, it is worthwhile analyzing your chat records to see what first messages customers send - are they short or do they mix languages?
For example, Ciao! My Lieferung ist late. Here we have 3 languages - Ciao being Italian. My Lieferung ist late is a mix of German and English.
There are places where it is common to mix languages and this can then cause confusion for the language detection as it sees words for example in Hindi and English.
Another consideration is that closely related languages such as Spanish and Catalan, Serbian and Croatian may have more overlap thus making some sentences hard to predict with a high confidence level.
In cases like this, we would not recommend setting up language detection as there is a chance of the bot being confused and setting a language that could be incorrect or sending the not understood reply.
Resetting Language Value - Best Practice
Since there are many people working and traveling in locations that are not aligned with the language they are the most comfortable with, we recommend setting this up so your customers can communicate with you in their preferred language.
To reset the visitor's language, you can ask the chat visitor to reset the language or utilize the language not supported intent by creating a do you speak Intent. This "Do you speak..." Intent can then hard reset the bot language, by then applying this as the active language. You can set it up as follows;
Set up a change language Intent
In the Dialogue Builder of that Intent,
check the active language to give options for languages
add buttons that correspond to the languages the bot supports
Add actions to set the language based on conversation data
An alternative option is to create a Content Entity list for languages and use this to check for what a user would like to speak.
Set up a change language Intent
In the Dialogue Builder of that Intent, add a conditional block to check the entity list to see if the message includes an option.
Note - it could be that a user says I don't speak English and then English would be set as the language.
- Add actions to set the language based on conversation data
Welcome Message with Language Selection
You would like to set up a welcome reply that asks users to choose the language they would like to speak as you believe that with the considerations mentioned above it would provide the best customer experience. When setting up a welcome reply, you can choose to try to retrieve the language preference from the CRM as a bot action on the event chat started to pull this information from the CRM.
Based on this information you can then use a conditional block to divert users to the correct reply using a conditional block. However, you can also choose to still ask the user their language preference. If the field is empty or not one of the languages you have trained then you can ask the user to select their preferred language.
Setting up a Welcome Reply for Zendesk Chat
Zendesk chat is a little special when it comes to triggering a reply seamlessly in the correct language if you are pulling this from the CRM. First, you will need to create a template reply that will be the first triggered message before the welcome reply which just checks the parameter and then routes to the correct welcome reply.
Secondly, you will need to create a bot action on chat start to trigger this reply instead of the system welcome reply. You can do this by going into Settings > Bot Actions > Create Action. From here you need to make the selections of chat started for Zendesk chat to trigger a reply and then select the reply from the drop-down.