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' => 'john@example.com' ),
	array( 'email' => 'harry@example.com' )
);

Unsubscribe users from a list:

$iterable->list_unsubscribe( $list_id, array(
	array( 'email' => 'john@example.com' ),
	array( 'email' => 'harry@example.com' )
) );

Events

Add an event to a user profile:

$iterable->event_track( 'john@example.com', 'Test Event' );

Tie user event to a specific campaign

$iterable->event_track(
    'john@example.com',
    'test event',
    time(),
    array(
        'some data field' => 'some data field value'
    ),
    false,
    'some campaign id',
);

Users

Get a user by email:

$iterable->user( 'john@example.com' );

Change a user's email:

$iterable->user_update_email( 'old@example.com', 'new@example.com' );

Delete a user:

$iterable->user_delete( 'john@example.com' );

Get available fields for users:

$iterable->user_fields();

Update multiple users at once:

$iterable->user_bulk_update( array(
    array(
        'email' => 'john@example.com',
        'dataFields' => array( 'name' => 'Jack' )
    ),
    array(
        'email' => 'mary@example.com',
        'dataFields' => array( 'name' => 'Jane' )
    )
) );

Update a user's subscriptions:

$iterable->user_update_subscriptions( 'john@example.com' );

Update a user:

$iterable->user_update(
    'john@example.com',
    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( 'test@example.com', $purchases );

Update a user's cart:

$iterable->commerce_update_cart(
    array( 'email' => 'john@example.com' ),
    array( array(
        'id' => '1',
        'name' => 'widget',
        'price' => 10,
        'quantity' =>1
    ) )
);

Send an email using a trigger campaign:

$iterable->email( 1600, 'john@example.com' );

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( 'test@example.com', 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