@@ -11,7 +11,7 @@ http://www.klaviyo.com/
1111## How to install?
1212
1313 composer require klaviyo/php-sdk
14-
14+
1515## API Examples
1616
1717After installing the Klaviyo package you can initiate it using your public token which is for track events or identifying profiles and/or your private api key to utilize the metrics and list apis.
@@ -26,32 +26,32 @@ You can then easily use Klaviyo to track events or identify people. Note, track
2626### Track an event
2727``` php
2828use Klaviyo\Model\EventModel as KlaviyoEvent;
29-
29+
3030$event = new KlaviyoEvent(
3131 array(
3232 'event' => 'Filled out Profile',
3333 'customer_properties' => array(
34- 34+ 3535 ),
3636 'properties' => array(
3737 'Added Social Accounts' => False
3838 )
3939 )
4040);
41-
42- $client->publicAPI->track( $event );
43- ```
41+
42+ $client->publicAPI->track( $event );
43+ ```
4444### You can also add profile properties to the 'customer properties' attribute in the Event model
4545``` php
4646use Klaviyo\Model\EventModel as KlaviyoEvent;
47-
47+
4848$event = new KlaviyoEvent(
4949 array(
5050 'event' => 'Filled out Profile',
5151 'customer_properties' => array(
52525353 '$first_name' => 'Thomas',
54- '$last_name' => 'Jefferson'
54+ '$last_name' => 'Jefferson'
5555 ),
5656 'properties' => array(
5757 'Added Social Accounts' => False
@@ -65,7 +65,7 @@ $client->publicAPI->track( $event );
6565### or just add a property to someone
6666``` php
6767use Klaviyo\Model\ProfileModel as KlaviyoProfile;
68-
68+
6969$profile = new KlaviyoProfile(
7070 array(
7171@@ -74,7 +74,7 @@ $profile = new KlaviyoProfile(
7474 'Plan' => 'Premium'
7575 )
7676);
77-
77+
7878$client->publicAPI->identify( $profile );
7979```
8080
@@ -88,11 +88,11 @@ $client->metrics->getMetrics();
8888$client->metrics->getMetricsTimeline();
8989
9090#return a specific metric timeline using its metric ID
91- $client->metrics->getMetricTimeline ( 'METRICID' );
91+ $client->metrics->getMetricTimelineById ( 'METRICID' );
9292
9393#export metric specific values
94- $client->metrics->exportMetricData ( 'METRICID' );
95- ```
94+ $client->metrics->getMetricExport ( 'METRICID' );
95+ ```
9696
9797### You can create, update, read, and delete lists. See here for more information https://www.klaviyo.com/docs/api/v2/lists
9898``` php
@@ -103,22 +103,22 @@ $client->lists->createList( 'List Name' );
103103$client->lists->getLists();
104104
105105#Get information about a list
106- $client->lists->getListDetails ( 'ListId' );
106+ $client->lists->getListById ( 'ListId' );
107107
108108#update a lists properties
109- $client->lists->updateListDetails ( 'ListId', 'ListName' );
109+ $client->lists->updateListNameById ( 'ListId', 'ListName' );
110110
111111#Delete a list from account
112112$client->lists->deleteList( 'ListId' );
113113
114114#Subscribe or re-subscribe profiles to a list
115- $client->lists->subscribeMemberstoList ( 'ListId', array $arrayOfProfiles );
115+ $client->lists->addSubscribersToList ( 'ListId', array $arrayOfProfiles );
116116
117117#Check if profiles are on a list and not suppressed
118118$client->lists->checkListSubscriptions( 'ListId', array $emails, array $phoneNumbers, array $pushTokens );
119119
120120#Unsubscribe and remove profiles from a list
121- $client->lists->unsubscribeMembersFromList ( 'ListId', array $emails );
121+ $client->lists->deleteSubscribersFromList ( 'ListId', array $emails );
122122
123123#Add members to list without affecting consent status
124124$client->lists->addMembersToList( 'ListId', array $arrayOfProfiles );
@@ -130,10 +130,10 @@ $client->lists->checkListMembership( 'ListId', array $emails, array $phoneNumber
130130$client->lists->removeMembersFromList( 'ListId', array $emails );
131131
132132#Get all exclusions on a list
133- $client->lists->getAllExclusionsOnList ( 'ListId' );
133+ $client->lists->getListExclusions ( 'ListId' );
134134
135135#Get all of the emails, phone numbers and push tokens for profiles in a given list or segment
136- $client->lists->getGroupMemberIdentifiers ( 'GroupId' );
136+ $client->lists->getAllMembers ( 'GroupId' );
137137```
138138
139139### You can fetch profile information given the profile ID, See here for more information https://www.klaviyo.com/docs/api/people
@@ -162,7 +162,7 @@ $client->profiles->getProfileMetricTimeline( 'ProfileId', 'MetricId' );
162162 ` {"detail":"Request was throttled. Expected available in 26.0 seconds.","retryAfter":26} `
163163
164164### Klaviyo\Exception\KlaviyoAuthenticationException
165- Thrown when there is an authentication error when making an API request, usually caused by an invalid API key.
165+ Thrown when there is an authentication error when making an API request, usually caused by an invalid API key.
166166
167167### Klaviyo\Exception\KlaviyoResourceNotFoundException
168168 Thrown when the system attempts to update a property that doesn't exist. For example, attempting to update a list that doesn't exist on the account.
0 commit comments