Skip to main content

Solved

12017 Topics
Subscribing user to a list using the API

Hello everybody,Β I’m integrating a popup for newsletter susbscription on a Prestashop website and IΒ want to send the email registered to the API β€œlist subscription”.I already have an hook which is call after a newsletter subscription and call the β€œsubscribeCustomer” function of the KlaviyoApiWrapper class with params: β€œemail” => customer@mail.comΒ and β€˜customerProperties’ => []Β The function is succefully called, but the problem is on API call I think, on β€œsubscribeMemberToList” function, i have a request to:url:Β https://a.klaviyo.com/api/v2/list/(my_list_id)/subscribewith this body:Β {Β Β Β Β "profiles":[Β Β Β Β Β Β Β Β {Β Β Β Β Β Β Β Β Β Β Β Β "email":"exemple@mymail.com",Β Β Β Β Β Β Β Β Β Β Β Β "$phone_number":null,Β Β Β Β Β Β Β Β Β Β Β Β "$first_name":null,Β Β Β Β Β Β Β Β Β Β Β Β "$last_name":null,Β Β Β Β Β Β Β Β Β Β Β Β "$source":"PrestaShop",Β Β Β Β Β Β Β Β Β Β Β Β "$consent":[Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β "email"Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β ]Β Β Β Β Β Β Β Β }Β Β Β Β ]}Β And the request return an empty response with the status code 200 (success), but nothing is add on my list. I already tried to ch