Transifex

Introduction

Transifex is a Localization Automation Platform that helps developers and marketers publish digital content across multiple languages.

MoEngage <> Transifex

MoEngage and Transifex integration makes use of MoEngage's Content APIs to fetch real-time translations for all your content through Transifex allowing you to deliver high-quality, localised content in your campaigns. This automates translation and frees up your teams to focus on delivering brilliant customer experiences.

 

Integration 

 

PREREQUISITES

  • Ensure you have access to your Transifex account.

MoEngage connects to Transifex's REST API Endpoints to fetch 

Step 1: Generate your Transifex bearer token

You can get your Bearer token from the Transifex dashboard under Settings >> API token >> Generate a token. You need to note down this value somewhere safe as this token will not be shown again.

Step1.png

Step 2: Test your API results

Use the below cURL to test out your results and the order of the strings. You can also choose to get translations by a resource string key. View all the configurations here.

curl --request GET \
'https://rest.api.transifex.com/resource_translations?filter[resource]=o:{ORGANISATION-SLUG}:p:{PROJECT-SLUG}:r:{RESOURCE-SLUG}&filter[language]=l:{LANGUAGE-SLUG}&filter[resource_string][key]={RESOURCE-STRING-KEY}' \
--header 'Accept: application/vnd.api+json' \
--header 'Authorization: Bearer {YOUR-BEARER-TOKEN}'

Make sure to replace the bold placeholders with actual values before testing. Here is a sample response:

{
    "data": [
        {
            "type": "resource_translations",
            "id": "o:****:p:****:r:****:s:****:l:hi_IN",
            "attributes": {
                "strings": {
                    "other": "नमस्ते और Transifex में आपका स्वागत है!"
                },
                "reviewed": true,
                "proofread": false,
                "finalized": true,
                "datetime_created": "2022-06-27T01:33:10Z",
                "datetime_translated": "2022-06-27T01:52:19Z",
                "datetime_reviewed": "2022-06-27T01:52:22Z",
                "datetime_proofread": null
            },
            "relationships": {
                "resource": {
                    "data": {
                        "type": "resources",
                        "id": "o:****:p:****:r:****"
                    },
                    "links": {
                        "related": "https://rest.api.transifex.com/resources/o:****:p:****:r:****"
                    }
                },
                "language": {
                    "data": {
                        "type": "languages",
                        "id": "l:hi_IN"
                    },
                    "links": {
                        "related": "https://rest.api.transifex.com/languages/l:hi_IN"
                    }
                },
                "translator": {
                    "data": {
                        "type": "users",
                        "id": "u:aekansh.dixit"
                    },
                    "links": {
                        "related": "https://rest.api.transifex.com/users/u:****"
                    }
                },
                "reviewer": {
                    "data": {
                        "type": "users",
                        "id": "u:****"
                    },
                    "links": {
                        "related": "https://rest.api.transifex.com/users/u:****"
                    }
                },
                "proofreader": null,
                "resource_string": {
                    "data": {
                        "type": "resource_strings",
                        "id": "o:****:p:****:r:****:s:****"
                    },
                    "links": {
                        "related": "https://rest.api.transifex.com/resource_strings/o:****:p:****:r:****:s:****"
                    }
                }
            },
            "links": {
                "self": "https://rest.api.transifex.com/resource_translations/o:****:p:****:r:****:s:****:l:hi_IN"
            }
        }
    ],
    "links": {
        "self": "https://rest.api.transifex.com/resource_translations?filter[resource]=o:****:p:****:r:****&filter[language]=l:hi_IN&filter[resource_string][key]=****",
        "next": null,
        "previous": null
    }
}

Step 3: Setup Content APIs in MoEngage Dashboard

Use MoEngage Content APIs to add Transifex as one of your data sources. You can add multiple APIs from Transifex at the same time for each use case.

Setting up the API

  1. Navigate to Settings >> APIs >> Content API.
  2. Click Add
  3. Add your Transifex API to the endpoint URL.

API URL

https://rest.api.transifex.com/resource_translations

Headers

Parameter Description Example
Authorization
Required. API Bearer key.
Bearer SGVyZSBpcyBhbiBleGFtcGxlIG9mIHlvdXIgQVBJIGtleS4=

 

Step2.png

Parameters

Parameter Description Example
filter[resource]
The resource filter.
o:organization_slug:p:project_slug:r:resource_slug

 

filter[language]

Filter by language.
l:en_US
step3.png
 
  1. Click Save. Now, you will see your Transifex API added in MoEngage.

Note - You can also test your APIs by clicking on the Test button. You can test your API response and validate.

Step 4 - Using content APIs in MoEngage campaigns

You can now use these content APIs in your campaigns. Read here to know more about Content APIs.

  1. On step 2 on your campaign creation, enter @.
  2. In the pop up, you can select the Content API configured in Step 2.
  3. You can use MoEngage Templating Language to parse through the API response and use the content in your campaigns.

Step4.png

Was this article helpful?
0 out of 0 found this helpful