CORS policy: No 'Access-Control-Allow-Origin' from Shopify Store
Hi, I am currently using Klaviyo javascript client to do OnSite Activity: I have tried to unsubscribe a profile from a list using below code structure:
Unfortunately, I am getting CORS error, even though the site is made request over HTTPS.
How can I get resolve from this? Or How can I unsubscribe from a klaviyo list using JavaScript client? Any help would be appreciate
Page 1 / 1
Hi @mohammadliton91 and welcome to the Community!
I see that you’re using the v2 List&Segments endpoint to accomplish the unsubscribe. I am going to check with our engineering team to see if they can provide some insight to this error, but in the meantime, have you considered using our new v3 endpoints?
The ‘unsubscribe profile from list’ action can be completed using our updated Lists endpoint, with this format:
Also, here are some more Community threads dealing with similar topics, if you’re interested:
I will update the thread shortly, and thanks for using the Community!
- Brian
Hi Brian, Thanks for your reply.
I’ve tried with your given updated endpoint but still getting the same error :’(
Hi@mohammadliton91!
Sorry for my delay in getting back to this thread, but I’ve actually found the cause of this issue. The v2 lists & segments endpoint is server-side only, so you can only call client-side using the ajax endpoint like in this example subscribe request below:
Additionally, it turns out that this endpoint only accepts POST requests, so you actually cannot unsubscribe profiles from a list using this endpoint - explaining the error.
You can utilize a specific list's unsubscribe page for this purpose if you wish, by navigating to the List in your account and then clicking Settings to find the url for the unsubscribe page.
I hope this helps to clarify, and thanks for using the Community!