Solved

Adding a user to a list by API (v2) is NOT triggering the flow. How do i do this?

  • 10 January 2022
  • 6 replies
  • 684 views

Badge +2

Hi. I have written a little php script using cURL and the v2 Klaviyo API to simply ADD a new user / profile to a given list i have set up on Klaviyo.

I was HOPING that this would trigger a flow rule i have on klaviyo (when someone is added to this list trigger this email flow), but no luck.

I think (im just guessing), that adding by API is not the same as triggering by a user subscribing (like via shopify integration or something)... just adding them to my list doesn't trigger the flow.

 

So i'm wondering if it's because i should be using the TRACK api versus the RESTful v2 api? I've reached the end of my knowledge and ability, so turning to the API-Experienced-Devs here :)

DEVS-Do you know what's going on here? If so how can you help?

Thanks.
Tom.

see attached screenshots.
1. simple code im using to test api >> fake user gets onto klaviyo list from this curl. GREAT
2. klaviyo screenshot showing user was created on that list. GREAT
3. the flow rule that never gets triggered: NOT GREAT :(

 

icon

Best answer by DavidSandel 31 March 2022, 12:43

View original

6 replies

Userlevel 5
Badge +18

Hi @TomBot2000,

 

I’m trying to subscribe a profile to a list just as you have done above. I recreated your code snippet in the first screenshot (with my List ID and API key), but the test email/profile is not being added/updated/sent to Klaviyo.

Is it possible you have a few other lines of code not shown in your screenshot?

I’ve also tried using the PHP, cURL example here with no luck too.

And the kicker is that I know I’m hooking into the right WooCommerce action because I’m using that same action to send other data to Klaviyo via the Track endpoint and that works perfectly.

Thank you!

Badge +1

Any updates on this case?

Userlevel 7
Badge +58

Hi there @TomBot2000,

Welcome to the Community! I hope I can help provide some info that leads you to a solution.

If I'm understanding correctly, you're wanting to use our API to trigger a Flow in your account for a number of profiles. We don't currently have an API that would accomplish triggering any Flow from the start for a profile. Instead, you would need to have the respective profile trigger the Flow naturally to start going through it.
If you were wanting to trigger a List-Triggered Flow, you could use our List API V2 endpoint to subscribe profiles to your List. Alternatively, if you were wanting to trigger a Metric-Triggered Flow based on a custom metric you set up, you would be able to build your metric using our Track API: Track and Identify API Reference.

Hope this cleared things up!
Alex
 

Userlevel 7
Badge +58

Apologies @TomBot2000 and @jonasost,

But you were correct in using the Track API for this scenario. For custom metrics/events - you’ll need to use our Server Side Track API endpoint.

We have both Javascript and server-side endpoints for our Track API (for sending events) and Identify API (for creating and updating profile properties). Here is some more specific information about our APIs that can be used to build out such events:

API Reference Guide
Track API Information
Getting Started with Javascript API

 

Badge +2

hi @alex.hong  and thank you for the reply.

Unfortunately that is not the issue. In face i am successuflly and simply able to use the subscribe endpoint (list api v2) … no issues!

 

I post to the correct list with the list_id and authenticate with my key, no issues. 

 

from my server side PHP script i am able to submit an email address / create the profile and subscribe that user to a testlist no issue. 

 

the problem is that the FLOW i built on this list never triggers!

 

the list is not set to double opt in (default). i actually turned that off // to single. the flow is just simple: trigger when someone subscribes to the list, and send a notification to me.  but testing it, the php script repeatedly succeeds in adding new profiles, and subscribing them to that list, and yet, the automation (flow) never responds. the actions are set to LIVE not draft. but the stats show 0 events, 0 notifications, 0 emails sent out. WHY??

 

thanks!

Tom.

Badge +2

@jonasost a small update from me: just to say to be extra careful that you match the endpoint with the trigger. in my tests i was experimenting with both member and subscribe endpoints. and they both work as expected, but in your FLOW just also make SURE that the trigger (eg. when a new user SUBSCRIBEs to a list, do this...) make sure that is in line with the enpoint you are using “subscribe” in this case WILL trigger such a flow, but not “member”. which willl just add that member to your list but not trigger the flow. so make sure the trigger and endpoint match up.

 

Reply