top of page

E2F: Detect Language

Leverage the Detect Language apex action to detect the language for a given sample text.

 

NOTE: The Google Translation API is a paid Google Service.  Please reference Googles pricing guide for more information ( Pricing  |  Cloud Translation  |  Google Cloud).  

Inputs

Sample Text

The sample text to determine the language.  For a typical Email-to-Case scenario, this sample text should be the plain text body of the incoming email.

Sample Text Max Length

The maximum length used to determine the email body language.  Start with a size of 100 and adjust it according to your testing results.

Outputs

Language Detected

The language which was detected in the sample text.

IsSuccess

​Set to True if the apex action was successful.  Set to False if an error was encountered.

Error Message

If isSuccess is False, the message of the error encountered

Additional Requirements

The Detect Language apex action leverages the Google Cloud Translation Basic V2 API.  In order to leverage this API, you will need a Google account with the Cloud Translation API enabled and the appropriate API keys to make authenticated calls.  Please review Cloud Translation to generate the API Key.

Create an External Credential

In the Quick Search Box, enter “Named Credentials” or navigate to Security > Named Credentials.  Select “External Credentials”.  Click on the New button.  Enter the values and choose Save.

external credentials.png

Label

Google Language Detect 

Name

​Google Language Detect

Authentication Protocol

Custom

Locate Custom Headers and click the New Button.  Enter the values and save the record.

custom header.png

Name

X-goog-api-key

Value

Enter Your API Key

Authentication Protocol

Custom

​Locate Permission Set Mappings and click the New button.  Associate the credentials to all permission sets that require the ability to execute the apex action.  For example, this configuration assigns the credentials to the Sales Cloud User permission set.  NOTE: The Identity Type will always be Named Principal and no Authentication Parameters are required.

edit perm.png

In the Quick Search Box, enter “Named Credentials” or navigate to Security > Named Credentials.  Select “Named Credentials”.  Click on the New button.  Enter the values and choose Save.

named.png

Label

DetectLanguage

Name

DetectLanguage

Generate Authorization Header

unchecked

Allowed Namespaces

EmailToFlow

The completed setup should look similar to the following:

complete.png
bottom of page