Dynamic Post API


I have created an app with that is kind of like AirBnb & Yelp, but for events. I want to be able to send an email to users one a week with events in their area that fits their criteria. API’s are fairly new for me, but I am thinking I need to create a Post call to send the JSON data to Klaviyo to send the data to my users. Is this even possible? 


4 replies

Userlevel 7
Badge +60

Hi there @JessicaSquire


Thanks for sharing your question with us! Cool idea!


This type of question is best suited for our developer-minded friends so I’m gonna transfer this question to this specific group.


@Brian Turcotte, @Omar @retention @DavidV thoughts?



Userlevel 6
Badge +24

Hi @JessicaSquire,

Welcome to the Klaviyo community and thank you for the tag @Taylor Tarpley!

This definitely sounds like an exciting opportunity, and one that I can definitely see Klaviyo fitting in well. 

When you say you’re looking to utilise the Klaviyo APIs, do you already have the platform itself up and running? The reason I ask is that you may be able to achieve some of this directly in Klaviyo without needing to use APIs. 

Klaviyo’s sign up forms have evolved to be able to capture a lot of data about customers that they are able to change themselves. You may be able to get started with a sign up form asking customers about their preferences (Let’s say I am a customer based in New Zealand that like attending Music Festivals, Art Exhibitions and Food Festivals). 

Once you have captured this information you can start using these custom profile properties to create segments of customers that you can send campaigns to. This can be based on a combination of those examples above. 

This would be how I would get started - so you can be up and running pretty quickly. Embedding a sign up form into a website is pretty straightforward. 

If you do want to build out an integration, this would be a great place to get started. You can kickstart your development journey with the Klaviyo Developer Certificate which explains the Klaviyo data model, show you the client-side and server-side APIs and teach you how to get data into Klaviyo using the APIs. Klaviyo has built out a full set of Postman Collections that help you fully test all of the available APIs in an easy environment. I also highly recommend taking a look at - a company Klaviyo acquired that can help if you’re looking to test some of the Webhook functionality (you can create webhooks to update your own backend directly inside of flows - I wrote an article on this here - although Shopify focussed this should show you how we make use of this).

I threw a lot of information at you - hopefully that helps you on your journey to discovering how you can put this together - both as an initial MVP and future state. Feel free to ask any questions on here - we’re a friendly bunch and always happy to spark ideas off! 


Userlevel 3
Badge +10

Hello @JessicaSquire 


Here is what you can do.

Your website will source of truth to assign nearby events to a user profile. Once you have the nearby events for a user then you can pass the events in a profile event against a Klaviyo profile. 

it will work as the purchase/ add to cart event but in your case it will be event data


Check the events API here:

Now create a treighger which can be trigger by the  event data and personalize the email based on the attributes passed in the event payload.

Userlevel 7
Badge +58

Basically agree with @DavidV and @Maxbuzz here. If you want to use the API, you may need a bit of practice with it to know how to pass data (aka events, but ironically about your Events!) to Klaviyo. 

The approach that @Maxbuzz mention seems like the most logical approach.  You have a code that periodically checks new events (or new users) to see if there’s a match, and it sends an event call to Klaviyo via the API. 

This metric will act as your Trigger to a Flow that sends them messages about the event.  All the data you pass can then be used in that email Template as event variables (about the Event).  Here, your code manages the rules to send events to Klaviyo, and Klaviyo simply sends the emails via the Flow.  

Another approach, which can work if you have logical segments of users (e.g. by City, or by “miles around a zip code”), you can create all the Segments ahead of time and make sure you provide the relevant data of their location from your web app into the users’ profile data. 

You can create a separate web data feed that contains your Event details for each Segment (e.g. New York City Events, Los Angeles Events, etc) and then use the API to schedule a Campaign to each and every Segment with a predefined Template that has the matching web data feed selected.  So people in the New York City Segment, will get the New York City Template (that uses the New York City Web Data Feed) and so on for each logical Segment of your users. 

You’ll then want to use the API (Create Campaign and Create Campaign Send Job ) to create these campaigns and schedule them because it could be tedious to setup dozens of Campaigns each week by hand. Have the API schedule each weeks Campaigns.

The first approach is a lot cleaner, but requires you to build the rules within your app.  The later approach relies more on Klaviyo builtin Segmentation capabilities which gives you more visibility on what’s happening via the Campaign analytics.  Not to mention, it might good to see the performance of each Campaign (for each Segment) to see how they compare.