Sitemap

SFMC Tips #410 : Agentforce: Displaying Language-Specific Welcome Messages in Multiple Languages

--

Press enter or click to view image in full size
Photo by 愚木混株 Yumu on Unsplash

In Agentforce Welcome messages, it is possible to display predefined text for each language, such as Japanese, English, and Traditional Chinese.

This is a frequently asked question, but it seems that the “Agent Name” cannot be multilingual. I have also confirmed this with Salesforce Support. If anyone knows a way to achieve this, please let me know in the comments.

Normally, Welcome messages are automatically translated according to the agent’s language settings. However, this time, I will introduce a method for displaying specific text for each language without relying on automatic translation.

The method involves switching the text using a formula field based on the language of the Messaging Session and inserting that value into the Welcome message.

This simply applies the technique used to dynamically insert information such as a customer’s name into a Welcome message, but replaces the entire text instead.

Configuration Steps

① Create a Formula Field on Messaging Session

From Object Manager, create the following field on Messaging Session.

  • API Name: Welcome_Text__c
  • Data Type: Formula
  • Return Type: Text

The following is an example of the formula. The Welcome message is managed within this formula field.

CASE(
LEFT(LOWER(TEXT(EndUserLanguage)), 2),
"en", "Hello. How can we help you today?",
"zh", "您好,請問有什麼可以協助您的地方?",
"こんにちは。お気軽にご相談ください。"
)

This assumes that the conversation language is set in EndUserLanguage, a standard field on Messaging Session. Presumably, this process has already been completed in environments configured for multiple languages, but please verify it.

Since EndUserLanguage is a standard picklist field on Messaging Session, TEXT() is used to convert it into a string.

Get Nobuyuki Watanabe @marketingcloudtips’s stories in your inbox

Join Medium for free to get updates from this writer.

Note: Also configure read access to this field for the required execution users.

② Add a Linked Variable to Agent Script

Add a variable that references the formula field to the existing variables block.

variables:
WelcomeFixedText: linked string
description: "Fixed welcome text. Do not translate or paraphrase."
label: "Welcome fixed text"
source: @MessagingSession.Welcome_Text__c

③ Reference It from the Welcome Message

Modify messages.welcome in the existing system block as follows. Leave existing settings such as error unchanged.

welcome: "<keep>{!$Context.WelcomeFixedText}</keep>"
  • After $Context, specify the context variable name, not the field API name.
  • According to the official documentation, the correct syntax here should originally be {!@variables.contextVariableName}. However, in my case, I encountered an issue where {!@variables.contextVariableName} was displayed as-is in the Welcome message. Therefore, I am using the older syntax ($Context.).

If anyone knows the cause of this issue, please leave a comment.

④ Publish, Activate, and Verify in Multiple Languages

Save the changes to Agent Script, then execute Commit Version and Activate.

After that, reload the web page and start a new conversation in each language — Japanese, English, and Traditional Chinese — to verify the displayed Welcome message.

Note: In the official Salesforce blog, <keep> is introduced as a workaround to protect specific phrases from translation, but it is also stated that the results may vary depending on the environment. Please verify the display in each language in the environment where you use it.

Conclusion

By the way, the method introduced this time is intended to display predefined Welcome messages for each language.

Agentforce also has a feature that automatically translates Welcome messages.

When the agent’s Default Language and End User Language are different, and the target language is configured as an additional language, the standard Welcome message is automatically translated.

Therefore, if automatic translation by Agentforce is sufficient, there is no need to configure additional formula fields or Agent Script settings as described in this article.

On the other hand, if a company wants to specify the exact text for each language or avoid differences in wording caused by translation as much as possible, the method introduced here is an option.

However, if completely fixed text must be displayed, it is necessary to thoroughly verify the display results in the actual environment.

That’s all for this article.

Nobuyuki Watanabe

https://www.linkedin.com/in/nobuyuki-watanabe/ (+Follow me)

--

--

Nobuyuki Watanabe @marketingcloudtips
Nobuyuki Watanabe @marketingcloudtips

I publish articles about Salesforce Marketing Cloud, Agentforce and Data Cloud (Data 360). I hope they can be helpful for your learning and day-to-day work.