Skip to content

Template Rendering

Render Jinja2 templates with dynamic data. Generate formatted messages, documents, or reports from templates.

Endpoint: POST /biz/cloud/convert/template_message

Parameters

The bizContent accepts a JSON object with template rendering parameters. The specific parameters depend on the template being rendered.

ParameterTypeRequiredDescription
templateStringYesJinja2 template string or template identifier
dataObjectNoKey-value pairs to inject into the template

Request

bash
curl -X POST "https://api.alaikis.com/std/biz/cloud/convert/template_message" \
  -H "X-API-Key: your_api_key" \
  -H "X-API-Secret: your_api_secret" \
  -d 'bizContent={"template": "Hello {{ name }}, your order #{{ order_id }} has been shipped.", "data": {"name": "John", "order_id": "12345"}}'

Response

json
{
  "code": 200,
  "msg": "success",
  "data": {
    "result": "Hello John, your order #12345 has been shipped."
  }
}

Template Syntax

Uses Jinja2 templating syntax:

SyntaxDescriptionExample
Variable interpolation
{% if condition %}Conditional block{% if active %}Active{% endif %}
{% for item in list %}Loop block{% for i in items %}{% endfor %}
| filterFilter application0