Klaviyo icon

Klaviyo

Interact with Klaviyo API

Actions3

Template → Template Render

AI-generated

Overview

The Klaviyo Template Render operation allows you to render a specific email template in Klaviyo using dynamic variables. This is useful for previewing or generating personalized content before sending emails, such as rendering a welcome email with user-specific data. Common scenarios include testing templates, generating previews, or integrating with other systems that require rendered email content.

Example use cases:

  • Previewing how an email will look for a specific user.
  • Generating personalized content for transactional emails.
  • Integrating with external systems that need the rendered output of a Klaviyo template.

Properties

Name Type Meaning
Variables Fixed Collection A collection of key-value pairs to be injected into the template as dynamic variables.
Template ID String The unique identifier of the Klaviyo template to render.

Details:

  • Variables: Each variable consists of a "Name" (the variable key) and a "Value" (the value to substitute in the template).
  • Template ID: The ID of the template you want to render.

Output

The node returns the rendered template as JSON. The structure typically includes the rendered HTML and possibly other metadata provided by the Klaviyo API. The exact fields depend on the Klaviyo response, but you can expect at least:

{
  "data": {
    "id": "template_id",
    "type": "template-render",
    "attributes": {
      "html": "<rendered HTML here>",
      // ...other possible attributes
    }
  }
}
  • If the API returns binary data (not typical for this endpoint), it would represent the rendered content in a non-JSON format.

Dependencies

  • External Service: Requires access to the Klaviyo API.
  • API Key: You must provide a valid Klaviyo API Key via n8n credentials (klaviyoApi).
  • n8n Configuration: No special configuration beyond setting up the credential.

Troubleshooting

Common Issues:

  • Invalid API Key: If the API key is missing or incorrect, you'll receive an authentication error. Ensure your klaviyoApi credential is set up correctly in n8n.
  • Missing Template ID: If the Template ID is empty or invalid, the API will return a not found or validation error.
  • Variable Formatting: If variables are not provided as expected (e.g., missing names or values), the rendered output may not substitute values correctly.

Error Messages:

  • "401 Unauthorized": Check your API key.
  • "404 Not Found": Verify the Template ID exists in your Klaviyo account.
  • "400 Bad Request": Ensure all required fields are filled and variables are formatted properly.

Links and References

Discussion