Klaviyo Templates

Reads and writes Klaviyo email templates.

Configuration

- klaviyo_templates:
    name: save_template
    operation: upsert
    credentials_path: /etc/klaviyo/credentials.json
    payload:
      from_event: true

Fields

FieldTypeDefaultDescription
namestringrequiredTask name.
operationstringrequiredSee the table below.
credentials_pathstringrequiredPath to the credentials file.
base_urlstringKlaviyo’sKlaviyo API address, for example a proxy.
template_idstringTemplate ID for get, update, delete, render, and clone.
filterstringKlaviyo filter for list, e.g. equals(name,'Welcome').
fieldslistallTemplate attributes get and list return, e.g. [name, editor_type, html]. Leaves out the drag-and-drop definition, which can be large.
payloadobjectThe template’s attributes, or from_event: true. See Payload.
depends_onlistUpstream task names.
retryobjectRetry configuration.

Operations

OperationNeedsWhat it does
gettemplate_idGets the template.
listLists templates matching filter, or all of them.
createpayloadCreates a template. Attributes: name, editor_type (e.g. CODE), html, text.
updatetemplate_id, payloadUpdates the template.
upsertpayload with nameUpdates the template with that name, or creates it. Keeps the number of templates down: Klaviyo allows 1,000 templates created through the API.
deletetemplate_idDeletes the template.
rendertemplate_id, payload with contextRenders the template with the variables in context.
clonetemplate_idCopies the template, named payload.name if set.

Output

The Klaviyo response as JSON. list emits one event per page, with the templates in data. delete emits {"id": "...", "done": true}.