Skip to main content
Solved

Can we add user to list using javascript object

  • February 17, 2024
  • 3 replies
  • 231 views

Forum|alt.badge.img+2

I have gone through the Javascript object but not getting much information about it. I am trying to add user to list using javascript object. Is it possible or should I use API?

Best answer by KeviSunshine

H @tarunsoni2705,

Oh! I understand! You’re asking whether there’s a function provided by the Klaviyo object that allows you to subscribe someone to a list. The answer is no: you cannot subscribe someone to a list using the Klaviyo object.

 

You can create profiles in Klaviyo using the `identify` method and track events using the `track` method, but you’ll need to use a custom API call to subscribe profiles to lists.

 

Best,

Kevn.

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

3 replies

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

Hi @tarunsoni2705,

Do you mean you’re trying to import via a JSON object?

To add a user to a list, you can import a CSV file, manually add users, or use the API to send your JSON in bulk.

Depending on what your use case is, it sounds like converting your JSON to CSV or using the API would be best.

 

Cheers,

Kevin.


Forum|alt.badge.img+2
  • Author
  • Contributor I
  • 2 replies
  • February 18, 2024

Hello Kevin,

 

I am not importing any CSV. I have create account form in frontend and have a field where customer has to select an option “Subscribe to list”. 

My main query is can we use Klaviyo JavaScript object in frontend to add a new user to specific list?

 

Here is the link of Klaviyo JavaScript Object.

https://developers.klaviyo.com/en/v1-2/docs/introduction-to-the-klaviyo-object


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

H @tarunsoni2705,

Oh! I understand! You’re asking whether there’s a function provided by the Klaviyo object that allows you to subscribe someone to a list. The answer is no: you cannot subscribe someone to a list using the Klaviyo object.

 

You can create profiles in Klaviyo using the `identify` method and track events using the `track` method, but you’ll need to use a custom API call to subscribe profiles to lists.

 

Best,

Kevn.