38 added
20 removed
Original
2026-01-01
Modified
2026-03-10
1
<p><em>Solution Recipes are tutorials to achieve specific objectives in Klaviyo. They can also help you master Klaviyo, learn new third-party technologies, and come up with creative ideas. They are written mainly for developers & technically-advanced users.</em></p>
1
<p><em>Solution Recipes are tutorials to achieve specific objectives in Klaviyo. They can also help you master Klaviyo, learn new third-party technologies, and come up with creative ideas. They are written mainly for developers & technically-advanced users.</em></p>
2
-
<p><strong><em>Note:</em></strong><em>We do our best to make sure any code and API references are accurate and current when this is published, but you might need to update code and it’s always a best practice to leverage our</em><a><em>latest API versions</em></a><em>. If you have questions, feel free to hop over to our</em><a><em>Developer Community</em></a><em>.</em></p>
2
+
<p><em><strong>Note:</strong>We do our best to make sure any code and API references are accurate and current when this is published, but you might need to update code and it’s always a best practice to leverage our<a>latest API versions</a>. If you have questions, feel free to hop over to our<a>Developer Community</a>.</em></p>
3
<p>What you’ll learn</p>
3
<p>What you’ll learn</p>
4
-
<p>How to utilize flow webhooks functionality and send additional data to Klaviyo by using Track/Identify API endpoints, transform the data, and ingest properties at the top-level that were previously nested deeper within the data structure.</p>
4
+
<p>How to utilize flow webhooks functionality and send additional data to Klaviyo by using Track/Identify API endpoints, transform the data, and ingest properties at the top-level that were previously nested deeper within the data structure.We will showcase two main examples:a) Use Klaviyo’s webhooks and track API to transform the event data that was previously deeply nested and not usable in segments and flow filters.b) Use Klaviyo’s webhooks to extract a value from a metric and utilize the Identify API to help dynamically personalize the content in an email.</p>
5
-
<p>We will showcase two main examples:a) Use Klaviyo’s webhooks and track API to transform the event data that was previously deeply nested and not usable in segments and flow filters.b) Use Klaviyo’s webhooks to extract a value from a metric and utilize the Identify API to help dynamically personalize the content in an email.</p>
6
<p>Why it matters</p>
5
<p>Why it matters</p>
7
-
<p>It’s not always possible to control how the original data is passed to Klaviyo, especially from a third-party app, which can make it challenging to customize flows, campaigns, etc.</p>
6
+
<p>It’s not always possible to control how the original data is passed to Klaviyo, especially from a third-party app, which can make it challenging to customize flows, campaigns, etc.What we<strong><em>can</em></strong>do on our end - use Klaviyo’s flow webhooks and Track/Identify API endpoints to transform the ingested data for further email/sms personalization.</p>
8
-
<p>What we <strong><em>can</em></strong> do on our end - use Klaviyo’s flow webhooks and Track/Identify API endpoints to transform the ingested data for further email/sms personalization.</p>
9
<p>Level of sophistication</p>
7
<p>Level of sophistication</p>
10
<p>Moderate</p>
8
<p>Moderate</p>
11
<h2>Introduction</h2>
9
<h2>Introduction</h2>
12
<p>By popular demand, Klaviyo has launched flow webhooks. This functionality helps explore more avenues with ingesting and passing data, and makes the life of the merchants/developers easier.</p>
10
<p>By popular demand, Klaviyo has launched flow webhooks. This functionality helps explore more avenues with ingesting and passing data, and makes the life of the merchants/developers easier.</p>
13
-
<p><a>Klaviyo flow webhooks</a> pass the information to third-party applications by making an HTTP POST request via a flow action. Data sent can include anything you would normally be able to access in a flow, including customer profile and event data.</p>
11
+
<p><a>Klaviyo flow webhooks</a>pass the information to third-party applications by making an HTTP POST request via a flow action. Data sent can include anything you would normally be able to access in a flow, including customer profile and event data.</p>
14
<p>There is a lot that can be done via Klaviyo flow webhooks, it is incredibly powerful because at its core it allows you to send a POST request that is triggered based on any of the available flow triggers, including being added to a segment or list, in response to an event, or at a specific timestamp.</p>
12
<p>There is a lot that can be done via Klaviyo flow webhooks, it is incredibly powerful because at its core it allows you to send a POST request that is triggered based on any of the available flow triggers, including being added to a segment or list, in response to an event, or at a specific timestamp.</p>
15
-
<p>Today, we will discuss two <em>specific</em> instances, using webhooks and Klaviyo’s APIs to hydrate additional data into Klaviyo.The steps below will showcase how to pass the nested data back to Klaviyo as top-level and be able to segment that data to further personalize emails. You will also learn how to extract a profile property and add it directly to the template in Klaviyo.</p>
13
+
<p>Today, we will discuss two<em>specific</em>instances, using webhooks and Klaviyo’s APIs to hydrate additional data into Klaviyo.The steps below will showcase how to pass the nested data back to Klaviyo as top-level and be able to segment that data to further personalize emails. You will also learn how to extract a profile property and add it directly to the template in Klaviyo.</p>
16
<h2>Challenge</h2>
14
<h2>Challenge</h2>
17
<p>To better understand what these two API endpoints ( track/identify) entail, here is a brief definition/distinction of the two. Identify and Track are used to store customer data and track activity.</p>
15
<p>To better understand what these two API endpoints ( track/identify) entail, here is a brief definition/distinction of the two. Identify and Track are used to store customer data and track activity.</p>
18
<p>The<a>Create or Update profile endpoint</a>updates properties about a recipient without tracking an associated event.</p>
16
<p>The<a>Create or Update profile endpoint</a>updates properties about a recipient without tracking an associated event.</p>
19
<p>Example: recipient’s information about their city of residence, their birthday, favorite color, etc.</p>
17
<p>Example: recipient’s information about their city of residence, their birthday, favorite color, etc.</p>
20
-
<p><a>Create Event endpoint</a> is used to track a profile activity.</p>
18
+
<p><a>Create Event endpoint</a>is used to track a profile activity.</p>
21
<p>Example: customer placed an order, cancelled order, etc.</p>
19
<p>Example: customer placed an order, cancelled order, etc.</p>
22
<p>The below image illustrates the capabilities of API vs flow webhooks at Klaviyo:</p>
20
<p>The below image illustrates the capabilities of API vs flow webhooks at Klaviyo:</p>
23
<p><em>Note:<em>Flow webhooks are not meant to be a two-way exchange of data in Klaviyo. Unlike API’s, they only work in one-direction which is posting the new information.</em></em></p>
21
<p><em>Note:<em>Flow webhooks are not meant to be a two-way exchange of data in Klaviyo. Unlike API’s, they only work in one-direction which is posting the new information.</em></em></p>
24
<h2>Ingredients</h2>
22
<h2>Ingredients</h2>
25
-
<ul><li>Klaviyo flow with a webhook action using the <a>Create or Update Profile</a>endpoint to ingest that data back to Klaviyo.</li>
23
+
<ul><li>Klaviyo flow with a webhook action using the<a>Create or Update Profile</a>endpoint to ingest that data back to Klaviyo.</li>
26
-
<li>Klaviyo flow with webhook action using<a>Create Event</a> endpoint to remap the event data and send the events back to the Events API to make nested properties top-level, segment the data for future personalization of messages</li>
24
+
<li>Klaviyo flow with webhook action using<a>Create Event</a>endpoint to remap the event data and send the events back to the Events API to make nested properties top-level, segment the data for future personalization of messages</li>
27
</ul><h2>Instructions</h2>
25
</ul><h2>Instructions</h2>
28
<h3><strong>Example 1: Using webhooks and Create or Update Profile API endpoint:</strong></h3>
26
<h3><strong>Example 1: Using webhooks and Create or Update Profile API endpoint:</strong></h3>
29
<p>Let’s say you wanted to send additional data to Klaviyo such as a sleep preference value that would help personalize your email template and use the dynamic values to populate that data about each recipient. It has historically been hard to do because our profile property setting requires you to type out the hard-coded value in the template, whereas in this case, the value will be dynamic from the event payload. Below are the steps that will help execute the above task:</p>
27
<p>Let’s say you wanted to send additional data to Klaviyo such as a sleep preference value that would help personalize your email template and use the dynamic values to populate that data about each recipient. It has historically been hard to do because our profile property setting requires you to type out the hard-coded value in the template, whereas in this case, the value will be dynamic from the event payload. Below are the steps that will help execute the above task:</p>
30
<h4>1. Create flow with webhook action:</h4>
28
<h4>1. Create flow with webhook action:</h4>
31
<p>You will need to go to flows in Klaviyo → select trigger → drag-drop the webhook action in actions tab</p>
29
<p>You will need to go to flows in Klaviyo → select trigger → drag-drop the webhook action in actions tab</p>
32
<h4>2. Configure the webhook settings:</h4>
30
<h4>2. Configure the webhook settings:</h4>
33
-
<p><strong>Destination URL</strong>:<a>1 https://a.klaviyo.com/api/profile-import</a></p>
31
+
<p><strong>Destination URL</strong>:<a>https://a.klaviyo.com/api/profile-import</a></p>
34
<p><strong>Headers</strong>:</p>
32
<p><strong>Headers</strong>:</p>
35
-
KeyValueContent-typeapplication/vnd.api+jsonacceptapplication/vnd.api+jsonrevision2024-10-15AuthorizationKlaviyo-API-Key {YOUR_PRIVATE_API_KEY}<p>You will need to<a>create a Private API Key</a>with the scopes:<em>profile:write</em></p>
33
+
<p>Key</p>
36
-
<p>In our particular case, we are adding “ShippingRate” property, so we can <em>dynamically</em> populate it per recipient, instead of relying on a hard-coded value in the email template.</p>
34
+
<p>Value</p>
37
-
<p>The JSON Payload used is below. In the 1 properties section, this is where you can add the information you want to store as a profile property. In this example we are creating a new profile property called “ShippingRate” and setting it to the value of “ShippingRate” from our event.</p>
35
+
<p>Content-type</p>
36
+
<p>application/vnd.api+json</p>
37
+
<p>accept</p>
38
+
<p>application/vnd.api+json</p>
39
+
<p>revision</p>
40
+
<p>2024-10-15</p>
41
+
<p>Authorization</p>
42
+
<p>Klaviyo-API-Key {YOUR_PRIVATE_API_KEY}</p>
43
+
<p>You will need to<a>create a Private API Key</a>with the scopes:<em>profile:write</em></p>
44
+
<p>In our particular case, we are adding “ShippingRate” property, so we can<em>dynamically</em>populate it per recipient, instead of relying on a hard-coded value in the email template.</p>
45
+
<p>The JSON Payload used is below. In the properties section, this is where you can add the information you want to store as a profile property. In this example we are creating a new profile property called “ShippingRate” and setting it to the value of “ShippingRate” from our event.</p>
38
{ "data": { "type": "profile", "attributes": { "id" : "{{person.KlaviyoID}}", "properties": { "ShippingRate": "{{ event.ShippingRate }}" } } } }<h4>3. Test the webhook:</h4>
46
{ "data": { "type": "profile", "attributes": { "id" : "{{person.KlaviyoID}}", "properties": { "ShippingRate": "{{ event.ShippingRate }}" } } } }<h4>3. Test the webhook:</h4>
39
<p>Once we are done with the above configuration, let’s go ahead and test the results.Click on the preview webhook button → send test request → make sure you get the success message in the top right corner of the flow page:</p>
47
<p>Once we are done with the above configuration, let’s go ahead and test the results.Click on the preview webhook button → send test request → make sure you get the success message in the top right corner of the flow page:</p>
40
<p>Now, lets see if the properties registered in the profile of the recipient we tested the webhooks for:It looks like the test worked, “ShippingRate” for the recipient we sent a webhook is now set to “Economy”.</p>
48
<p>Now, lets see if the properties registered in the profile of the recipient we tested the webhooks for:It looks like the test worked, “ShippingRate” for the recipient we sent a webhook is now set to “Economy”.</p>
41
<h4>4. Add the property for sleep preference to the email template:</h4>
49
<h4>4. Add the property for sleep preference to the email template:</h4>
42
-
<p>You could now use this profile property in segmentation or in any email template using the syntax 1 {{person.ShippingRate}}</p>
50
+
<p>You could now use this profile property in segmentation or in any email template using the syntax {{person.ShippingRate}}</p>
43
<h3><strong>Example 2: Using webhooks and Create Event endpoint:</strong></h3>
51
<h3><strong>Example 2: Using webhooks and Create Event endpoint:</strong></h3>
44
<p>Before we showcase the example using<a>Create Event</a>request, let’s briefly discuss what the top-level and nested properties are in general. A top-level property is an object which represents data that can be segmented and filtered on within Klaviyo, while nested properties are available to use in message templates, they are not identified as segmentable or filterable data points if they are not top-level. In order to be able to segment data in Klaviyo, values need to be sent as top-level properties.</p>
52
<p>Before we showcase the example using<a>Create Event</a>request, let’s briefly discuss what the top-level and nested properties are in general. A top-level property is an object which represents data that can be segmented and filtered on within Klaviyo, while nested properties are available to use in message templates, they are not identified as segmentable or filterable data points if they are not top-level. In order to be able to segment data in Klaviyo, values need to be sent as top-level properties.</p>
45
<p>For example, let’s say someone has placed an order that contains a lot of valuable information that is nested, such as SKU, ItemID, Quantity, etc. If you wanted to segment the placed order by SKU to later personalize your content, you’d need to send that data over as a top-level property.</p>
53
<p>For example, let’s say someone has placed an order that contains a lot of valuable information that is nested, such as SKU, ItemID, Quantity, etc. If you wanted to segment the placed order by SKU to later personalize your content, you’d need to send that data over as a top-level property.</p>
46
<p>As mentioned above, this can be done by utilizing our flow webhooks functionality and Klaviyo’s Create Event API endpoint. You might wonder about the benefits of nested data, especially that it can’t be segmented. The answer is that it comes in handy when sending messages using data in the metric. In the example we mentioned above, so you can display properties about each brand by iterating through the nested data in the message template. Below are the steps that show how to remap the data from nested to top-level property values.</p>
54
<p>As mentioned above, this can be done by utilizing our flow webhooks functionality and Klaviyo’s Create Event API endpoint. You might wonder about the benefits of nested data, especially that it can’t be segmented. The answer is that it comes in handy when sending messages using data in the metric. In the example we mentioned above, so you can display properties about each brand by iterating through the nested data in the message template. Below are the steps that show how to remap the data from nested to top-level property values.</p>
47
<h4>1. Create webhooks flow:</h4>
55
<h4>1. Create webhooks flow:</h4>
48
<p>Go to flows in Klaviyo → select trigger → drag-drop the webhook action in the actions tab:</p>
56
<p>Go to flows in Klaviyo → select trigger → drag-drop the webhook action in the actions tab:</p>
49
<h4>2. Configure the webhook:</h4>
57
<h4>2. Configure the webhook:</h4>
50
<p>Make sure to setup the destination URL which is</p>
58
<p>Make sure to setup the destination URL which is</p>
51
-
<p>Destination URL:<a>1 https://a.klaviyo.com/api/events</a></p>
59
+
<p>Destination URL:<a>https://a.klaviyo.com/api/events</a></p>
52
-
KeyValueContent-typeapplication/vnd.api+jsonacceptapplication/vnd.api+jsonrevision2024-10-15AuthorizationKlaviyo-API-Key {YOUR_PRIVATE_API_KEY}<p>To build the JSON body, you will include the properties you want and also include the name of the event you want to record.</p>
60
+
<p>Key</p>
53
-
<p><a><em>Here is the syntax</em></a><em> you’d need to add in the JSON block:</em></p>
61
+
<p>Value</p>
62
+
<p>Content-type</p>
63
+
<p>application/vnd.api+json</p>
64
+
<p>accept</p>
65
+
<p>application/vnd.api+json</p>
66
+
<p>revision</p>
67
+
<p>2024-10-15</p>
68
+
<p>Authorization</p>
69
+
<p>Klaviyo-API-Key {YOUR_PRIVATE_API_KEY}</p>
70
+
<p>To build the JSON body, you will include the properties you want and also include the name of the event you want to record.</p>
71
+
<p><em><a>Here is the syntax</a>you’d need to add in the JSON block:</em></p>
54
{ "data": { "type": "event", "attributes": { "properties": { "Shipping Rate": "{{event.ShippingRate}}" }, "metric": { "data": { "type": "metric", "attributes":{ "name" : "Selected Shipping Rate" } } }, "profile": { "data": { "type": "profile", "attributes": { }, "id": "{{person.KlaviyoID}}" } } } } }<p>The “<em>Selected Shipping Rate</em>” is the name of the new event that will be created</p>
72
{ "data": { "type": "event", "attributes": { "properties": { "Shipping Rate": "{{event.ShippingRate}}" }, "metric": { "data": { "type": "metric", "attributes":{ "name" : "Selected Shipping Rate" } } }, "profile": { "data": { "type": "profile", "attributes": { }, "id": "{{person.KlaviyoID}}" } } } } }<p>The “<em>Selected Shipping Rate</em>” is the name of the new event that will be created</p>
55
<p>The “properties” section is where the event information will go and can be modified as needed.</p>
73
<p>The “properties” section is where the event information will go and can be modified as needed.</p>
56
<h4>3. Test the webhook:</h4>
74
<h4>3. Test the webhook:</h4>
57
<p>Once you are done with setting up the webhooks configuration, go ahead and test the results.Click on the preview webhook button → send a test request → make sure you get the success message in the top right corner of the flow page.</p>
75
<p>Once you are done with setting up the webhooks configuration, go ahead and test the results.Click on the preview webhook button → send a test request → make sure you get the success message in the top right corner of the flow page.</p>
58
<h4>4. Test if the nested property got remapped and if we can segment the new top-level data:</h4>
76
<h4>4. Test if the nested property got remapped and if we can segment the new top-level data:</h4>
59
<p>Looks like we got the product ID and SKU in the event data:</p>
77
<p>Looks like we got the product ID and SKU in the event data:</p>
60
<h4>Impact</h4>
78
<h4>Impact</h4>
61
-
<p>This Solution Recipe displays how to maneuver the<a>flow webhooks </a>in combination with the Identify/Track API requests to ingest the additional data to Klaviyo without the need to make changes at the original data source.</p>
79
+
<p>This Solution Recipe displays how to maneuver the<a>flow webhooks</a>in combination with the Identify/Track API requests to ingest the additional data to Klaviyo without the need to make changes at the original data source.</p>
62
<p>The above examples demonstrate practical use-cases showing that webhooks are a powerful tool, and capable of much creativity. They can enhance and create new possibilities for personalization, templates, campaigns, segmentation, and more.</p>
80
<p>The above examples demonstrate practical use-cases showing that webhooks are a powerful tool, and capable of much creativity. They can enhance and create new possibilities for personalization, templates, campaigns, segmentation, and more.</p>
63
<p>To learn more about Klaviyo’s webhooks, check out this<a>link</a>!</p>
81
<p>To learn more about Klaviyo’s webhooks, check out this<a>link</a>!</p>
64
<h2>Learn more</h2>
82
<h2>Learn more</h2>
65
-
<p>If you’re interested in learning more about Klaviyo’s developer experience and capabilities, please visit<a> developers.klaviyo.com</a>!</p>
83
+
<p>If you’re interested in learning more about Klaviyo’s developer experience and capabilities, please visit<a>developers.klaviyo.com</a>!</p>
66
84