Search to See if a user is in a Klaviyo Segment

Using the Klaviyo module, I want to check to see if an email address is inside of a Segment. Usually on the Make modules, you can provide an email address and it will search for Profile ID or email…Then you can search, but for the Klaviyo module it seems the only way to search to see if a user is in a Segment is to use the List Profiles in a List or in a Segment module.

This way uses a lot of executions, because you have to literally search the entire Segment and search for the email address each time, rather than just searching directly.

Does anyone know a better way to search Klaviyo to see if an email address is in a specific segment?

I’m not a Klaviyo expert, but would the Check if Someone is in a Segment module do what you need?

1 Like

Hi @jmacman,

There are a few ways to do this, but the one that you are trying to use can be set up in a way that will cost just 2 operations if you want to go that route.

You can use, List Profiles in a List or in a Segment and add a array aggregator after the List module, with a filter in between to check if the email exists. This will make sure that it will cost 2 operations regardless of the number of results that you get from the List Module.

I need to thoroughly check how the API works with Klayvio, and I didn’t see a Make an API with it, but we could use Search Profile API endpoint which I believe can be used to search profile through an email address and the profile response seems to have all the list of Segments the profile is associated with.

1 Like

Ok, so if the Segment has 10k users in it, then youare saying that it will only cost me one or two operations to search through a segment? The other issue is that I will get a lot of timeouts when searching large Segments or lists.

I would rather do something like this: Check if Profiles Are in a Segment but it seems as if the JSON payload returns an error.

Technically Yes, But Make does have a limit I believe up to 3.2k records that will be returned through the Search Module.

I think using the HTTP module is a better option, Can you share me how you have setup the HTTP module and I will review what is wrong with it.

See Video Below. Just for the record, I tried using the API Key with and without the pk_ and it returns the same errors.

Use, API Key parameter name as api_key instead of PRIVATE_API_KEY

1 Like

Thanks so much buddy…It worked with a Response code of 200. I’m still learning Make.com and for the life of me, this API stuff is totally confusing.

@Runcorn How did you know to use api_key? Where is that in any documentation?

1 Like

It was in the Klayvio document that you shared.

1 Like

Well…Kind of…lol - --url ‘https://a.klaviyo.com/api/v2/segment/SEGMENT_ID/get-members?**api_key**=PRIVATE_API_KEY

The only documentation I see now is in the url. Man I wish they made API stuff a bit simpler. Thanks again! Your second time helping me out.

1 Like

@jmacman Did you try the Check if Someone is in a Segment module?

1 Like

Yep I used the Custom module using the Klaviyo API and it works great.

There’s a standard module called Check if Someone is in a Segment that I think should do the same job

The problem with this module is that you have to search the entire Segment for a user. Some of my segments are 10k or more which there is a limit as to how many profiles you can search and the API limits for searching so many profiles. You have to search the entire list first with this module. That is a problem for large segments.

@DavidGurr_Make There is no standard module to check to see if someone is in a Segment. The only module is to check to see if someone is in a List. It’s called Check and Search Profiles on a List. The only other way to check to see if a profile is on a list is to use the List Profiles in a List or in a Segment module. The problem with this module is that you have to literally poll the entire list, then make a filter to see if the email is on the list. This is not practical for lists that are in the thousands.

My mistake - the Help doc includes info on the Check if Someone is in a Segment module, but that module doesn’t seem to exist.

I’m checking to see if that’s a documentation error or a missing module.

2 Likes

Thanks for checking on this. I would much rather use the module than the API, so I hope this can be added in the future, if it is missing.

Please keep us updated as this is a very powerful and important feature.

OK, so it seems that the Check if Someone is in a Segment module used the v2 API, which I see you’ve also referenced in your earlier posts.

The v1 and v2 APIs are listed by Klaviyo as being end-of-lifed on Jan 1, 2024. As a result, we’ve deprecated that module (meaning that it works if you’re already using it, but it’s not available for selection).

You might be best using the Klaviyo Get Segment Profiles endpoint. We’ve not yet implemented that as a module - but we’ll take a look at that.

2 Likes

Ahhh…thanks for the update! I’ll try to implement it in replacement of the other as it is an important module. @DavidGurr_Make I hope you guys do implement it soon.

I need some help on this new API - Get Segment Profiles. I was able to Authenticate with the newest version, but it seems as if I don’t understand how to use a specific email to filter. I’m using the following URL - https://a.klaviyo.com/api/segments/1235/profiles/?filter=email, and I’m not sure if the email should be an actual email address or if there is a string I need to use. I put an actual email address and it didn’t work.