Integrate your Certainly bot with Crowdin

The Crowdin integration allows your Certainly chatbot to seamlessly request and print Crowdin translations into your conversations.

In this article, we'll explore how to do the following:

Get Crowdin's variables

In order for us to make API requests to translate, we need four elements:

You can also read Crowdin's documentation regarding Crowdin API v2.

API personal access token (PAT)

To create a new token, please follow these simple steps:

  1. On Crowdin's website, navigate to the profile menu in the top right corner and select "Settings". 
    8-_Settings.png

  2. Navigate to the API Tab, then select "New Token".
    9-_Settings-ApiTab%2BNewToken1.png

  3. Make sure you copy and save that token as it will only be shown once.
    10-_NewToken.png

Project ID

Navigate to your project menu on the top left-hand side and select the desired project. Information from that project will be displayed on the right.
6-_CrowdIn-_ProjectId.png

Language ID

Assuming your project has at least one translation, we need to make sure that we use the right language code on the API request. Remember to use the correct one for the specific target language you used on your project (e.g., es-ES = Spanish).

String ID

In order to simply retrieve the string IDs of your source file, we are going to make a request using the wh_iconCrowdin - Get Sentence List Template Webhook and follow these 3 steps:

  1. First, add the API token (remember to include Bearer and a space before the token).
    14-_WH_SenList_setup2.png

  2. Next, add the Project ID number.
    14-_WH_SenList_setup.png

  3. If you run the Webhook and everything is correct, you'll have a response mapped below called "table" that displays only the String ID and the sentence in the source language.
    13-_WH_SenList_Cvas.png

    You can also find the string IDs linked to the specific sentences either from the file you uploaded yourself or from the translation platform on Crowdin's website.

Set up translation Webhook and Custom Variables

In order for the Webhooks to trigger a successful response, the previously explained steps need to be correct. Once we've gathered all the information needed, we can create a new Webhook.

To do so, access the Section menu in the Navigation bar, select "Webhook Builder", then choose "Create from Template". In the marketplace that opens, you will find the already created wh_iconCrowdin - Get Translation Webhook Template.

Inside, you will have to enter the required authentication (again, remember to add Bearer and a space before the token) and parameters for it to work. They are explained below:

  • languageId : Language code of target language (could be a fixed value if there's only 1 target language, e.g., "es-ES", or a variable such as "{{languageId}}" in the case that multiple translations are needed)
  • stringId : String ID of the sentence to be translated
  • projectId : Project ID of the source translation (can be a variable if working with multiple projects)
    11-_WH_GetTrans-_Auth_%2B_Params.png

After setting up the values/variables, you will find that there's a Custom Variable mapped named "translation". This Custom Variable will be used as a bot reply to display the translated response from the Webhook.

Design flow and add Webhook

Here you'll find an example of a small integration that includes multiple languages. For successful integration, we suggest following the steps below.

  1. First, set up the flow:
    0-_Bot_Canvas.png
    1-_Bot-LanguageSelect.png

  2. After selecting the desired language in the "Connections" tab, fill in the necessary values and add the wh_iconCrowdin - Get Translation Webhook. Remember to add the Go To / Fallback for that Module's desired translation.

    3-_Bot-ConnectionLangId%2BstringId%2BWH%2BGoto.png

  3. Navigate to that Module's "Message" tab. In the message bubble, add the Custom Variable [[translation]] (must be between the double brackets) in order for it to be printed during runtime. 
    4-_Bot-MsgVar.png

  4. Repeat the process of updating the values of the desired stringId, WH execution, and Module. In the example, there's no response needed after the <md>Welcome Module, which is why it skips ahead without a human reply.
    5-_Bot-Conn-stringId%2BWH%2BGoto.png

If you're able to replicate the functionality, you've succeeded at integrating Crowdin translations into your bot replies. Great work! Should you encounter any problems in the configuration, please contact our Customer Success team.