Translating a Rules Based Einstein Chatbot with the Metadata API
The purpose of this document is to show how a Salesforce Botmaster can use the metadata API to translate the messages, dialogs and questions of an existing Einstein bot.
Important: You must have installed Language I/O API plugin for Salesforce Chatbot to perform this operation.
The main benefit of this approach is that you do not need to create separate bot definitions for each required language. The languages are all stored within the same bot definition. You can configure the chatbot so that it automatically detects the language of a visitor and communicate with them in this language.
To translate an Einstein Chatbot with the metadata API, follow these steps:
- Configure the languages that will be used by the Einstein bots in the Salesforce org.
- Configure the languages each bot will use
- Go to Setup and search for "Custom Settings" to configure the Language I/O API Public Settings:
(Click to expand) - Fill in the necessary information:
(Click to expand)- The Named Credential that you set up during configuration. If you are not sure of which Named Credential to use, contact Language I/O Support.
- The number of independent translation callouts to the LIO server for each language. Add higher values for large bots.
- The number of independent translation files that you want to deploy for each language. Add higher values for large bots.
- Create a new Lightning tab
- Run the Translation process
- Open the new tab created in step 3
- Select the bot that you want to translate in the dropdown list, then select the version:
(Click to expand) - Click Get Bot Version Language. This can take up to two minutes.
- Select the desired Target Languages. By default, all the languages that you configured in Step 2 are selected:
(Click to expand) - Click Translate Bot Version Content. You might not see any visible change to the page but this starts the translation process. This can take up to 15 minutes.
Important: Remember that if this is an update to a bot that was previously translated, this process translates the entire contents of the Chatbot all over again, not just the parts that you updated.
- Go to Setup and type "deployment" in the search bar to find the "Deployment Status" page and open it. The following screenshot shows that the translation is complete and deployment is pending:
(Click to expand) - When deployment is complete, your Deployment Status page should look like this:
(Click to expand) - To verify that the translations are in place, return the the Einstein bot and compare the text from the Dialog Translations tab for each Dialog text:
(Click to expand)
- Configure the bots to determine the language of your visitors.
Important: For the Einstein bot to know what language to use to chat with a visitor, you must configure additional actions. In this example, the Chatbot uses the pre-chat subject to determine the language of a visitor.- In the Welcome dialog (or any other dialog that the bot uses to initiate the conversation), you must add a detection API call to determine the visitor’s language. You must add this before any other step.
(Click to expand)
- Input - 1: Set the Named Credential value with the name of the named credential that you use to connect to the Language I/O server.
- Input - 2: Set the routableID for the detection operation. This is a unique ID that identifies the operation in the API logs. For example, you can set this value to be the Record ID of the Chat, since all Chats already have unique IDs.
- Input - 3: Set the custom variable that contains the pre-chat subject
- Output - 1: This is the language code returned by the Detection API callout.
- Next, add a new rule to update the conversation language:
(Click to expand)
Here is an example of how you can configure how the bot starts the conversation:
(Click to expand)
- In the Welcome dialog (or any other dialog that the bot uses to initiate the conversation), you must add a detection API call to determine the visitor’s language. You must add this before any other step.
- Run subsequent bot translations when needed
- When you update a dialog, message or question in a bot’s primary language, this does not automatically updates the texts in the secondary languages. To make sure that all text is synchronized across all languages, run Step 4 : Run the translation process again.
Note: To update the translations of an active bot, you must deactivate the bot first, then reactivate it once the translation process is complete to apply the translation. Remember that an update translates the entire contents of the Chatbot all over again, not just the parts that you updated.
- When you update a dialog, message or question in a bot’s primary language, this does not automatically updates the texts in the secondary languages. To make sure that all text is synchronized across all languages, run Step 4 : Run the translation process again.
Known limitations
- In rare occasions where race conditions between the separate translation deployments are observed, this may result in the bot version not being translated, or being partially translated for certain languages. The issue is observable in the Deployment Status page, when there are fewer deployments than expected.
There are two potential workarounds for this issue:- Decrease the ‘Deployment Slices’ value in the Custom Settings.
- Restart the process by selecting fewer languages (Language I/O recommends is no more than three languages)
- The tab that contains the bot translation functionality may show a continuous "Loading" label, even though the contents of the tab are loaded. This will be fixed in a later release.
(Click to expand)
Comments
0 comments
Please sign in to leave a comment.