When deploying Einstein Bots in Salesforce’s Messaging for In-App and Web, providing a localized and personalized experience for your users is crucial. But how do you ensure that your bot communicates in the correct language?
I’ll guide you through a practical solution where I pass the user’s language code from Pre-Chat to the Messaging User Language field on the Messaging Session record. Then, the Einstein Bot will fetch this language code via a Flow, ensuring every interaction happens in the user’s preferred language.
Language Customization in Einstein Bots
By default, Einstein Bots are designed to handle multiple languages, but they need a way to identify the user’s preferred language. For customers engaging via Messaging for In-App and Web, this preference can be collected during the Pre-Chat process but requires some configuration to make it actionable for the bot.
Solution Overview
To set up language customization, we’ll leverage the following Salesforce components:
- Pre-Chat Setup: Collect the user’s language preference during the Pre-Chat form. This can be done by either directly asking the user to select their language in the form, or as a hidden field that is passed through based on the website the user is chatting from (https://developer.salesforce.com/docs/service/messaging-web/guide/pre-chat.html).
- Messaging Session Record Update: Map the language code from Pre-Chat to the Messaging User Language field on the Messaging Session record. We do this within the Omni-Routing Flow.
- Einstein Bot and Flow Integration: Configure a Flow to fetch the language code from the Messaging Session record and set it in the bot context.
- Configure an Auto-Launched Flow: To get your Messaging Session record, then assign the EndUserLanguage value that we mapped from our Omni-Routing Flow to a language output variable that our Bot can access.
- Within your Einstein Bot: Add your Flow as an Action and have the language output of the Flow set to a language input variable within your Bot.
- Set Up a Fall-Back Question: You may want to a question follow the action in case your language variable is ever blank after the flow.
- Configure an Auto-Launched Flow: To get your Messaging Session record, then assign the EndUserLanguage value that we mapped from our Omni-Routing Flow to a language output variable that our Bot can access.
Step-by-Step Implementation
1. Capture Language Code in Pre-Chat
- Configure your Pre-Chat Form to include a field for the user’s language preference (e.g., a dropdown for language selection or a hidden field if the preference is determined programmatically).
- Pass the selected language code as part of the Pre-Chat details to Salesforce.
2. Update the Messaging Session Record
- Use the Omni-Routing Flow tied to your Messaging Setting to map the language code from the Pre-Chat to the Messaging User Language field on the Messaging Session record. Make sure the language code you pass into this field matches one of Salesforce supported languages.
- This ensures the language preference is stored and accessible during the Messaging Session.
- This also lets any Messaging Components you have translated send to the user in their preferred language.
3. Fetch Language Code Using a Flow
- Create a Screen Flow or Auto-launched Flow that:
- Retrieves the Messaging Session. Create an input variable in the flow to store our Messaging Session Id. We can set this variable when we add our Flow action to our Einstein Bot later.
- Assign the value to a language output variable so our Einstein Bot can access it.
- Retrieves the Messaging Session. Create an input variable in the flow to store our Messaging Session Id. We can set this variable when we add our Flow action to our Einstein Bot later.
4. Integrate Flow with Einstein Bot
- In the Einstein Bot Builder, add a Flow action to your bot dialog.
- Invoke the Flow you created, and use the language code it retrieves to dynamically set the bot’s language for the session.
The Benefits of This Approach
This setup ensures that:
- The Einstein Bot automatically adapts to the user’s preferred language, creating a personalized experience.
- Agents and customers benefit from reduced friction and improved communication in their native language.
- The solution is scalable, supporting multiple languages and use cases without additional complexity.
Setting up your Einstein Bot to dynamically adapt to your users’ preferred language is a game-changer for delivering great support with Messaging for In-App and Web. By implementing this method, you can ensure every interaction feels personal and seamless.
Need help leveraging the latest Salesforce features and functionalities including Messaging for In-App and Web? Our team is here for you! You know where to find TruSummit Solutions.
Featured Articles
How to Dynamically Set Einstein Bot Language in Messaging for In-App and Web
When deploying Einstein Bots in Salesforce’s Messaging for In-App and Web, providing a localized and personalized experience for your users…
TruSummit Solutions Achieves Salesforce Crest Consulting Partner Status
At TruSummit Solutions, we’re constantly striving to deliver exceptional value to our clients and push the boundaries of what’s possible…
Boosting Agent Productivity in Salesforce: Keeping Conversations in View with Pinned Regions
Salesforce’s new Messaging for In-App and Web feature offers a seamless way to engage customers across multiple channels, but one…