Turn.io Integration
Turn.io ships built-in Lelapa.ai functions that expose Vulavula's Natural Language Processing capabilities inside Turn.io code blocks, so you can add intelligent text processing to your WhatsApp journeys.
You can also check out the Turn.io documentation for more information.
Prerequisites:
- A Vulavula API key — obtain it at the Vulavula Platform (see Authentication)
- Familiarity with the Turn.io platform and its code block functionality
All Lelapa.ai functions operate within Turn.io code blocks and require a connection object (conn) established using lelapa_connect().
1. lelapa_connect(token)
Establishes a persistent connection to the Lelapa.ai API using the provided API token. It handles authentication and sets up the necessary context for subsequent Lelapa.ai function calls.
| Parameter | Type | Description |
|---|---|---|
token | string | Your Lelapa.ai API token from your Lelapa.ai account |
Returns: conn (object) — a connection object that must be passed as the first argument to all other Lelapa.ai functions. Its structure is opaque; treat it as a connection handle.
Error handling: incorrect or invalid tokens will result in a connection error. Turn.io code blocks should handle potential errors during connection establishment.
Example (Turn.io start node):
Code
2. lelapa_translate(conn, text, source_language, target_language)
Translates the input text from source_language to target_language using Lelapa.ai's Translation API. It supports a range of languages, with a particular focus on African languages.
| Parameter | Type | Description |
|---|---|---|
conn | object | The connection object |
text | string | The text to be translated |
source_language | string | Language code of the source text (e.g., "eng_Latn", "zul_Latn") |
target_language | string | Language code for the desired translation (same code standard as the source) |
Returns: translation_result (map) — the translation result:
Code
Example (Turn.io code block):
Code
Important notes
- Language codes: ensure you use correct and supported language codes for
source_languageandtarget_languageinlelapa_translate()— see Language Support for the complete list. - Error handling: check for
nilreturn values or utilise Turn.io's error handling mechanisms within code blocks. - Rate limits and usage: be aware of the rate limits and usage quotas of your Vulavula account to avoid service interruptions — see plans for details.

