Solved

Is there a way to create a new segment through the API

  • 21 August 2021
  • 2 replies
  • 357 views

Badge +2

Hi, Everyone;

I’m wondering if there’s a way to create a segment through the API.

Essentially I’m struggling with a “Feature” that a client wants to make.

They’d like to create a product waitlist/invite system, by which people subscribe to a waitlist for a product on their site and then they invite x number of people at a time. (However, they want to automate all of it and don’t want anyone not invited to be able to buy the product).

My first thought was create a profile with a “Waitlist” event with the product details as a property, then creating something that will trigger an “Invited” on x number of profiles with the waitlist event on their accounts.

Then on the product page of the website have a checker that determines if the person was invited.

I was expecting the API to have a way to filter profiles by whether they have an event with a value, and another event with a different value. In my case

Select all profiles with:
Wishlist: T-Shirt and Not Invite T-Shirt

The problem is the API doesn’t seem to have the ability to do that. Which leaves me with my desperate plea to people undoubtedly smarter than me.

Is there a way to create a segment list through the API? Or can anyone think up a better solution for me to give a go.

Thanks

icon

Best answer by retention 23 August 2021, 22:35

View original

2 replies

Userlevel 7
Badge +57

@Tobear - I have a few suggestions you might want to consider, but not sure of your other needs or dependencies.

Hack the Back in Stock Feature 

If your client is on Shopify or BigCommerce, the use-case sounds eerily similar to a “Back in Stock” functionality. You can of course change the Button CTA to “Get on Waitlist” or something to make it sound more like a waitlist system rather than a “Back in Stock” system.  When the products’ inventory are added which they can control from the back-end, the Back in Stock Flow will send an email according to the Back In Stock rules and go down the queued list.  On the product page, if you don’t want people to be able to add to cart without going on the list first, then you can functionally just hide the “Add to Cart” and make the “Back in Stock” feature always there, and shows only if it was clicked over from the email (via a URL parameter).  This isn’t totally fail-safe, as people might share their link, etc.

Encode one Custom Property with Both Values:

Using your original event scheme, but append/concatenate the two separate values into one encoded value.  Example: “T-shirt : Not Invited” - then, you can use the “Query Event Data” of the Metrics API and use the  “where” clause to filter them out.  

Those are just some off-the-cuff ideas, I’m not sure if its constraints or restrictions will fit what you’re trying to do, but if you figure it out, share with the rest of us!

 

Badge +2

Hi, @retention 

Two great ideas, I’d looked into the Back In Stock system before, but clearly not well enough as I hadn’t noticed there was a rule system in place to send out the notification in delayed batches.

I think that should work expertly for our use case.

Thanks, a bundle. 👍Have an awesome, day.

Reply