Convenience methods
The fastest path to rendered output. Each method returns the output string directly.
-
Sync
-
Async
html = client.render_html("template-id")
tsx = client.render_react("template-id")
mjml = client.render_mjml("template-id")
html = await client.render_html("template-id")
tsx = await client.render_react("template-id")
mjml = await client.render_mjml("template-id")
All three accept an optional dynamic_data argument:
html = client.render_html("template-id", {
"merge_tags": {"text": {"name": "Noruwa"}},
"context": {"plan": "pro"},
})
render() — full control
Use render() when you need the full result object or want to specify the target dynamically.
-
Sync
-
Async
result = client.render(
template_id="550e8400-e29b-41d4-a716-446655440000",
target="html", # "html" | "react-email" | "mjml"
dynamic_data={
"merge_tags": {"text": {"name": "Noruwa"}},
"context": {"plan": "pro"},
},
)
print(result.output) # rendered string
print(result.target) # "html"
print(result.template_id) # "550e8400-..."
result = await client.render(
template_id="550e8400-e29b-41d4-a716-446655440000",
target="react-email",
dynamic_data={
"merge_tags": {"text": {"name": "Noruwa"}},
},
)
render() parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
|
|
✓ |
The template to render. |
|
|
|
|
|
|
Merge tags and context. See Dynamic Data. |