Skip to content

cdlewis/iterable-php-wrapper

Repository files navigation

Iterable PHP Wrapper

Build Status Coverage Status

Getting Started

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' );

Examples

Lists

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]' )
) );

Events

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',
);

Users

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' )
);

Campaigns

Get all campaigns:

$iterable->campaigns();

Create a campaign:

$iterable->campaigns_create( 'My Campaign', 1600, 1601, false, '11:00 AM' );

Commerce

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

Export as JSON:

$iterable->export_json( 'user', 'All' );

Export as CSV:

$iterable->export_csv( 'user', 'All' );

Workflows

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 );

About

PHP wrapper for the Iterable API (http://www.iterable.com).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages