Skip to main content
Contributor I
February 17, 2024
Solved

Can we add user to list using javascript object

  • February 17, 2024
  • 3 replies
  • 364 views

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?

    This topic has been closed for replies.
    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.

    3 replies

    KeviSunshine
    Expert Problem Solver III
    Expert Problem Solver III
    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.

    Contributor I
    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
    Expert Problem Solver III
    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.