The builder
Thetemplate helper returns an immutable builder — chain .body(), .header(), .button(), and .carousel() to add components:
Parameter helpers
Every variable in your template matches one of these factories. The type name is thetype field on the parameter.
| Helper | Use for |
|---|---|
text(value) | Plain text variables. |
image(media) | Header images. |
video(media) | Header video. |
document(media) | Header documents. |
location(loc) | Header location. |
payload(value) | Quick-reply button payload. |
couponCode(value) | Coupon code button. |
actionJson(value) | Catalog / flow action JSON. |
Header, body, buttons
button(index, ...) — quick-reply button, payload parameter.
urlButton(index, ...) — URL button, text parameter appended to the approved base URL.
Indexes correspond to the button positions defined when the template was approved.
Carousel templates
Carousels are body templates with per-card components:components list uses the same TemplateComponentInput shape the body builder produces — you can construct them with template(...) sub-builders or inline them.