Maps & Translation Docs 简体中文

Integration guides / SaleSmartly

Set up translation in SaleSmartly

Call the translation API from a SaleSmartly workflow, then send the translated text to the visitor. Use the public test key in the example to try it first.

Buy a translation API key on Taobao

1. Create a test workflow

Open Workflows in the SaleSmartly sidebar and click Create Workflow. Choose a test channel and a blank template, then open the editor.

Set the trigger to an incoming visitor message and add an External Request action using the plus menu. Available triggers and actions depend on your channel and account type.

2. Fill in the external request

Open the External Request action and fill in the following fields.

Method
POST
Request URL
https://api.companysou.com/language/translate/v2
Headers
Click Add and enter both values in the same row.
Left field Content-Type
Right field application/json
Body · Request JSON
{
  "key": "DEBUG_KEY_FOR_TESTING",
  "q": ["How can I help you?"],
  "target": "zh-CN",
  "format": "text"
}

Paste the JSON into Body. The example uses DEBUG_KEY_FOR_TESTING and targets Simplified Chinese for the first test.

3. Test and map the translation

Click Test Request. A successful request returns HTTP 200 and includes translatedText. The translation may differ slightly from the example.

Example success response
{
  "data": {
    "translations": [
      { "translatedText": "我能帮您什么?" }
    ]
  }
}

Response Mapping

In the same action, find Response Mapping, add a row, and paste this path into the left field.

JSONPath
$.data.translations[0].translatedText

Connect a Send Message action after External Request. In the message body, enter the variable displayed to the right of the mapping, such as {{FIELD_0}}. Trigger the workflow in a test conversation and check that the visitor receives the Chinese translation.

4. Set the live message and enable

  1. Replace the sample sentence in the q array with the reply you want to send. For a fixed reply, type the source text. If the workflow offers the message variable you need, select the sample sentence and insert that variable using the plus button in the Body editor. Keep the JSON array and string structure.
  2. Set target to the language the visitor should receive, such as en for English or ja for Japanese. Check the message and language in a test conversation.
  3. Before enabling the workflow, replace DEBUG_KEY_FOR_TESTING with a proxy API key that has translate permission. Save the workflow, link the account that should run it, and set its status to enabled.

The workflow sends translated text to the visitor. The chat window’s live translation follows the SaleSmartly project settings.

What should I check if the test fails?

For HTTP 403, check the key in Body. If you are using a production key, confirm that it is valid and has translate permission.

If the request succeeds but the message is blank, check that the mapping selects the first translatedText and that Send Message contains the variable shown next to the mapping.

If External Request is missing, open the Workflow editor and look under the plus menu for Actions. Available actions depend on the channel, account type, and conversation. See SaleSmartly’s channel guidance