Skip to main content
Solved

profile-subscription-bulk-create-jobs endpoint has no effect on profile


Forum|alt.badge.img+5

Hi,

I’m unit testing my code that uses the https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs/ endpoint. It’s a simple method to subscribe a single profile to a subs list. I’m testing against my test account.

Here’s the json: {"data":{"type":"profile-subscription-bulk-create-job","attributes":{"profiles":{"data":[{"type":"profile","attributes":{"email":"MY_EMAIL_ADDRESS_HERE","subscriptions":{"email":{"marketing":{"consent":"SUBSCRIBED"}}}}}]},"custom_source":"profile-subscription-bulk-create-job call on site"},"relationships":{"list":{"data":{"type":"list","id":"TVBgA3"}}}}}

My code just fires off a curl call with plain vanilla PHP. I get an empty response, as expected, and it comes with a 202 response, as expected. The dox (https://developers.klaviyo.com/en/reference/subscribe_profiles) say this means it was successful.

However, when I look at the profile on the dashboard it hasn’t changed, and no confirmation email was sent. My profile still just says ‘never subscribed’.

Is this expected for a test account, or should I test against some of my profiles on my live account?

(PS: I get the same results for trying to unsubscribe a profile using the endpoint profile-subscription-bulk-delete-jobs).

Many thanks,

Gareth

Best answer by dartacus

Having run my unit tests again and looking at the API logs in my test account, only 3 calls are logged there out of 19 tests. Digging deeper into the code looks like some of the tests are set to override with production keys no matter what key I supply, so not an issue with Klaviyo, it was the test harness at fault.

View original
Did this topic or the replies in the thread help you find an answer to your question?

5 replies

KeviSunshine
Expert Problem Solver III
Forum|alt.badge.img+8
  • Expert Problem Solver III
  • 159 replies
  • June 19, 2024

Hi Gareth,

This is not expected. I’ve used this endpoint a ton of times and haven’t seen this before. I primarily use single opt-in lists so I am not sure if that’s a confounding factor here.

I just tested with your exact request body and it worked. I suppressed my profile from email, called the endpoint, and I am now Subscribed to email. I didn’t change anything with your request body other than the email and list ID.

 

 

 

 

Cheers,

Kevin.


Forum|alt.badge.img+5
  • Author
  • Problem Solver III
  • 58 replies
  • June 19, 2024

@KeviSunshine thank you, I appreciate you going to the trouble to verify that for me.

I think I’d better (at this point triple) check that I’m using the correct key, list ID and profile email. Failing that I’ll just have to test it with live site credentials and see if it fires proper.


KeviSunshine
Expert Problem Solver III
Forum|alt.badge.img+8
  • Expert Problem Solver III
  • 159 replies
  • June 19, 2024

Yeah, that’d be my advice too– there must be at least one test profile in your live site, and you could probably just swap out the list ID and private key to point to the live site for a quick test of the code.

Out of curiosity, how are you doing test credentials? Do you have a separate, test instance of Klaviyo? 


Forum|alt.badge.img+5
  • Author
  • Problem Solver III
  • 58 replies
  • June 19, 2024

We’ve got a test account. Managed with the same login, but different keys etc.


Forum|alt.badge.img+5
  • Author
  • Problem Solver III
  • 58 replies
  • Answer
  • June 20, 2024

Having run my unit tests again and looking at the API logs in my test account, only 3 calls are logged there out of 19 tests. Digging deeper into the code looks like some of the tests are set to override with production keys no matter what key I supply, so not an issue with Klaviyo, it was the test harness at fault.