Getting Started

Connect and Go

This API endpoint allows for the translation of texts into different languages using the LetzChat service.

Endpoint

URL: https://letzchat.pro/firestoreconfig/translate_CUSTOM_ENDPOINT_PER_CUSTOMER.php
Method: POST
Authorization: Bearer Token

Headers

Content-Type: application/json
Authorization: Bearer CUSTOM-TOKEN-PER-CUSTOMER

Request Body
                
{
  "lang": "fr",
  "texts": [
    "hello my house is for sale",
    "the owl is silver"
  ]
}
                
            
Response
                
{
  "texts": [
    "bonjour ma maison est à vendre",
    "la chouette est argentée"
  ],
  "lang": "fr",
  "lang_source": "en"
}
                
            

Testing via Postman

Testing the API

To test the translation API:

  1. Open the Postman application.
  2. Create a new POST request to the endpoint URL: https://letzchat.pro/firestoreconfig/translate_CUSTOM_ENDPOINT_PER_CUSTOMER.php.
  3. Under the Authorization tab, select Bearer Token and paste the provided token: CUSTOM-TOKEN-PER-CUSTOMER.
  4. In the Body tab, choose raw and select JSON format. Paste the following JSON structure into the body:
                            
    {
      "lang": "fr",
      "texts": [
        "hello my house is for sale",
        "the owl is silver"
      ]
    }
                            
                        
  5. Click Send to execute the request.
Language Detection

To determine the user's current language on your webpage, use the lzCurrentLanguage variable. This variable holds the current language code, which can be sent to the API as the lang parameter for translations.

                
console.log("Current Language: " + lzCurrentLanguage);