Newsletter templates (add-on)
The layouts a campaign is written into, and their previews.
The layouts a campaign or an automation message is rendered through. See Campaigns.
List campaign templates
/api/v1/kahunacart/newsletters/templates
The starting points a merchant keeps — a subject, a preheader, some Markdown and a layout. A campaign copies a template once when it is created and never reads it again, so editing one changes what the next campaign starts from and nothing about what any campaign sent.
Parameters
| Name | Type | Description |
|---|---|---|
| active optional | string |
Pass "1" for only the templates offered when writing a campaign
One of:
1 |
Get one campaign template
/api/v1/kahunacart/newsletters/templates/{id}
One template with its subject, preheader, Markdown body and layout, plus the merge variables a campaign made from it may use.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | Template id |
Create a campaign template
/api/v1/kahunacart/newsletters/templates
Save the wording and layout worth reusing, so every campaign after this one starts from it. Merge tags are checked on save exactly as they are on a campaign, because a bad one here would otherwise be copied into every campaign made from it.
Parameters
| Name | Type | Description |
|---|---|---|
| name required | string | What the store calls it |
| subject optional | string | |
| preheader optional | string or null | |
| body_md optional | string or null | Markdown |
| layout optional | string |
One of:
store, plain |
| is_active optional | boolean | Whether it is offered when writing a campaign |
Edit a campaign template
/api/v1/kahunacart/newsletters/templates/{id}
Change a template. Campaigns already written from it keep their own copy and are not touched. Merge tags are checked against the template as it would stand afterwards, so a bad tag left in the body is reported even when only the subject was edited.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | Template id |
| name optional | string | |
| subject optional | string | |
| preheader optional | string or null | |
| body_md optional | string or null | |
| layout optional | string |
One of:
store, plain |
| is_active optional | boolean |
Delete a campaign template
/api/v1/kahunacart/newsletters/templates/{id}
Remove a starting point. Nothing points at it — every campaign ever written from it took a copy of its fields — so nothing else changes.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | Template id |
Preview a campaign template
/api/v1/kahunacart/newsletters/templates/{id}/preview
Render a template the way a campaign made from it would arrive, through the real layout with a sample subscriber and tracking off, and answer the HTML, the plain-text part and the subject. Any merge tag the sandbox will not allow comes back in the refusals list beside the render.
Parameters
| Name | Type | Description |
|---|---|---|
| id required | integer | Template id |
| subject optional | string | Override the saved subject for this render |
| preheader optional | string or null | |
| body_md optional | string or null | |
| layout optional | string |
One of:
store, plain |
Read a saved template preview
/api/v1/kahunacart/newsletters/templates/{id}/preview
The template as it is saved, rendered with sample content. The POST on the same path renders unsaved fields as well.