Clone the repository:
git clone https://github.com/cdlewis/iterable-php-wrapper.git
Include the wrapper:
require_once( 'iterable-php-wrapper/iterable.php' );
Instantiate the class with your API key:
$iterable = new Iterable( 'YOUR API KEY' );
Show all lists:
$iterable->lists();
Subscribe users to a list:
$iterable->list_subscribe( $list_id, array(
array( 'email' => '[email protected]' ),
array( 'email' => '[email protected]' )
);
Unsubscribe users from a list:
$iterable->list_unsubscribe( $list_id, array(
array( 'email' => '[email protected]' ),
array( 'email' => '[email protected]' )
) );
Add an event to a user profile:
$iterable->event_track( '[email protected]', 'Test Event' );
Tie user event to a specific campaign
$iterable->event_track(
'[email protected]',
'test event',
time(),
array(
'some data field' => 'some data field value'
),
false,
'some campaign id',
);
Get a user by email:
$iterable->user( '[email protected]' );
Change a user's email:
$iterable->user_update_email( '[email protected]', '[email protected]' );
Delete a user:
$iterable->user_delete( '[email protected]' );
Get available fields for users:
$iterable->user_fields();
Update multiple users at once:
$iterable->user_bulk_update( array(
array(
'email' => '[email protected]',
'dataFields' => array( 'name' => 'Jack' )
),
array(
'email' => '[email protected]',
'dataFields' => array( 'name' => 'Jane' )
)
) );
Update a user's subscriptions:
$iterable->user_update_subscriptions( '[email protected]' );
Update a user:
$iterable->user_update(
'[email protected]',
array( 'name' => 'Jack' )
);
Get all campaigns:
$iterable->campaigns();
Create a campaign:
$iterable->campaigns_create( 'My Campaign', 1600, 1601, false, '11:00 AM' );
Add a purchase to a user:
$purchases = array(
array(
'id' => '1',
'name' => 'widget',
'price' => 10,
'quantity' => 1
),
array(
'id' => '2',
'name' => 'knob',
'price' => 10,
'quantity' => 1
)
);
$iterable->commerce_track_purchase( '[email protected]', $purchases );
Update a user's cart:
$iterable->commerce_update_cart(
array( 'email' => '[email protected]' ),
array( array(
'id' => '1',
'name' => 'widget',
'price' => 10,
'quantity' =>1
) )
);
Send an email using a trigger campaign:
$iterable->email( 1600, '[email protected]' );
Export as JSON:
$iterable->export_json( 'user', 'All' );
Export as CSV:
$iterable->export_csv( 'user', 'All' );
Trigger workflow for email:
$iterable->trigger_workflow( '[email protected]', WORKFLOW_ID );
Trigger workflow for list (of emails):
$iterable->trigger_workflow( false, WORKFLOW_ID, false, LIST_ID );