Working with template translations

Define a template and use it to send multi-language messages


You can localize your messages by translating them into the language your audience uses through Falu's message templates. This way, you can ensure that your content is relevant and accounts for nuances, particularities, attitudes, and values.

Think about it: If you are targeting the Tanzanian market with an SMS marketing advert urging the public to visit Kenya's Mount Kenya, and your sale price is listed in Kenya Shillings, you have guaranteed their lack of interest.

Add translations to Falu templates

You can add language translations when creating or updating message templates.

Add translations when creating a template

Create your template as follows:

curl -X POST 'https://api.falu.io/v1/message_templates' \
     -H 'Content-Type: application/json' \
     -H 'X-Falu-Version: 2024-06-01' \
     -u "fskt_1234567890:" \
     --data '{
       "alias": "first-template",
       "description": "My first template",
       "body": " ",
       "translations": {
         "language1_ISO_code": {
           "body": " "
         },
         "language2_ISO_code": {
           "body": " "
         },
         "language3_ISO_code": {
           "body": " "
         }
       }
     }'

Add translations to an existing template

If you have an existing template with no previous language translations, you can add a translation using the PATCH call below:

curl -X PATCH 'https://api.falu.io/v1/message_templates/TEMPLATE_ID' \
     -H 'Content-Type: application/json' \
     -H 'X-Falu-Version: 2024-06-01' \
     -u "fskt_1234567890:" \
     --data '{
        "translations": {
            "desired_language_ISO_code": {
                "body":" "
            }
        }
     }'

On the other hand, if you want to update an existing translation in a template:

curl -X PATCH 'https://api.falu.io/v1/message_templates/TEMPLATE_ID' \
     -H 'Content-Type: application/json' \
     -H 'X-Falu-Version: 2024-06-01' \
     -u "fskt_1234567890:" \
     --data '{
        "translations": {
            "existing_language_ISO_code": {
                "body":" "
            }
        }
     }'

Sending a translated message

Once a template has all the desired translations, you can use it to send a message in any of the defined languages. To do so, make a POST call to the endpoint https://api.falu.io/v1/messages:

curl -X GET 'https://api.falu.io/v1/messages' \
     -H 'Content-Type: application/json' \
     -H 'X-Falu-Version: 2024-06-01' \
     -u "fskt_1234567890:" \
     --data '{
        "to":"+254SOME_NUMBER",
        "template":{
            "id":"TEMPLATE_ID",
            "language":"language_ISO_code",
            "model":{
            "key":"value"
            }
        },
        "stream":"STREAM_NAME"
    }'