Skip to main content

    Getting started with Advanced KDP

    Course overview
    Lesson
    2 min read

    Do more with your data

    Understand Code in Klaviyo Advanced KDP

    Code is a powerful in-app development tool that allows you to build and deploy custom functions in response to any event in Klaviyo. With Code, you have complete control over the event response with a fully-customizable payload, giving you true ownership over your data and workflows. This feature is best utilized by tech-savvy marketers or developers who want to build custom automated workflows based on events logged in Klaviyo.

    A preview of the Code recipe library

    With Code, so much is possible. You can write custom functions in Python or Node.js, or you can select a pre-built function from the recipe library. To give you some ideas on what you can do, we’ve populated some pre-built recipes into the library including:

    • Modify an event payload and forwarding a webhook downstream.
    • Convert currencies to normalize placed order metrics across multiple international storefronts.
    • Use GPT-3 to write a thank-you poem for someone who places an order.
    • Set a customer's birthdate on their profile (with the correct formatting) after they sign up.

    Once you choose your recipe, you’ll be given instructions on how to set the environment variables and execute the function. Be on the lookout for more recipes!

    Identify when to use Code over webhooks

    When you add Klaviyo Advanced KDP to the Klaviyo marketing app, you get access to 3 powerful tools that allow you to automatically send data from Klaviyo to other destinations. Those are webhooks in flows, webhooks in Advanced KDP, and Code. All 3 features allow you to send data out of Klaviyo in different scenarios. But what is the difference between each of these, and when should you use one over the other?

    Webhooks in flows

    Webhooks are available to all Klaviyo users as an action step in the flow builder. Flow webhooks can only send information based on the event that triggered the flow. This is great for triggering third-party systems to do things like send direct mail in response to a purchase, or send an automated message to a customer through Whatsapp. You can also customize the payload of the data that is sent to the third party system.

    Flow webhooks cannot be used with message-related events like Received email, Clicked email, Unsubscribed from list, etc.

    Webhooks in Advanced KDP

    Webhooks in Advanced KDP allow you to respond to any event that is logged in Klaviyo, including message-related events. They do not depend on a sequence of events like a flow does. A webhook through Advanced KDP will fire any time one of the specific events occurs. You can configure each webhook to a particular destination to respond to multiple events. For instance, you can send all email engagement metric data to your external reporting tool by setting up 1 webhook to the destination and choosing multiple topics (or events) to trigger the webhook.

    Webhooks in Advanced KDP do not require any knowledge of coding, therefore you cannot modify the payload that is being sent.

    Code

    Code is a low-code building tool that allows you to write fully custom functions in response to events logged in Klaviyo. On the back end, it relies on the same webhook functionality that other webhooks use, but there are two main reasons to use Code over webhooks:

    • To send requests to your external systems without hosting a public HTTP endpoint for the webhook.
    • To execute custom functions in response to an event in Klaviyo.

    In practice, this means your developers can create fully-automated workflows based on events logged in Klaviyo without any added cost to your business of maintaining additional cloud hosting solutions to run and execute the functions.

    Want more details? Learn more about the difference between these 3 options for sending data to external systems.

    Do more with your data