Create a code template (HTML + CSS + Handlebars)
create_code_templateCreates a NEW code-kind template on the feed. Body is Handlebars: {{title}}, {{price}}, {{brand}}, etc. plus helpers from list_handlebars_helpers (formatPrice, truncate, stripHtml, …). Variable bag includes everything in product.rawData plus derived fields (sale_percentage etc.; sale_percentage already ends with "%", e.g. "20%", so write -{{sale_percentage}}, not -{{sale_percentage}}%). It goes live at once and replaces the always-on active template of the same placement. placement "4_5" or "9_16" makes a Meta aspect-ratio variant instead of the main image: Meta feeds then also carry a 4:5 (Feed) or 9:16 (Stories, Reels) image per product, tagged so Meta picks it per placement; the canvas must be exactly that ratio (default 1080×1350 / 1080×1920). The response repeats the placement's safe zones. After creation, call preview_render to see the result inline.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"feedId": "<feedId>",
"name": "<name>",
"codeHtml": "<codeHtml>"
},
"name": "create_code_template"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| width | No | Output width in px. Default 1080 (1080×1080 is the standard square ad size). | |
| feedId | Yes | ||
| height | No | Default: 1080, or 1350 / 1920 for placement 4_5 / 9_16. | |
| codeCss | No | CSS string. Will be inlined into the HTML via juice before satori-html parses it. | |
| codeHtml | Yes | Handlebars-enabled HTML body. Will be wrapped in <html><body>… automatically by the renderer. | |
| placement | No | "default" = main image; "4_5" / "9_16" = Meta aspect-ratio variant. | default |
| outputFormat | No | jpeg | |
| backgroundColor | No | Hex like "#FF6600". Shown behind transparent areas. | #FFFFFF |