Solved

Can we use Google Cloud function to call Klaviyo API as it's throwing cross origin error from front end?

  • 12 May 2021
  • 1 reply
  • 188 views

Badge +2

Getting below error while making api call.


Access to XMLHttpRequest at 'https://a.klaviyo.com/api/v2/list/{LISTID}/subscribe' from origin 'website' has been blocked by CORS policy.

And we don’t want to use built-in forms. So just wanted to know whether it will be possible using Google Cloud Function or not.

Thank you!

icon

Best answer by Dov 13 May 2021, 16:46

View original

1 reply

Userlevel 7
Badge +61

Hi @himalay,

Thank you for sharing your question with the Klaviyo Community.

I noticed you came across another thread which addresses the CORS error which my colleague Paul addressed (linked below).

 

With respect to your question in that thread -- if using Google Cloud is applicable for SMS subscriptions specifically, Klaviyo does not have a formal SMS subscription pathway for Google Cloud so we cannot say for certain that this will work. All of Klaviyo’s methods to gather SMS subscriptions are outlined in Klaviyo’s Guide to Collecting SMS Consent. If you decide to test this subscription method using Google Cloud, you should keep in mind the general guidelines outlined in the post linked above, and be careful using the front-end so Google Cloud does not risk exposing your private API key for security purposes. 

Thanks and have a wonderful day.

 

Reply