generationtux/marketo-rest-api-client

Marketo Rest Api Client

v0.0.5 2016-11-22 21:18 UTC

This package is not auto-updated.

Last update: 2023-01-31 14:50:41 UTC


README

Build Status

Installation

composer require generationtux/marketo-rest-api-client

Usage

Instantiation

$client = new Client([
    'api_url' => 'foo.bar/api',
    'client_id' => 'foobarid',
    'client_secret' => 'foobarsecret'
]);

Creating a lead

Click here to find all valid fields for leads.

$client->leads()->create([
    [
      'firstName' => 'Joe',
      'lastName'  => 'Bar',
      'email'     => 'foolead1@bar.com'
    ],
    [
      'firstName' => 'Sally',
      'lastName'  => 'Bar',
      'email'     => 'foolead2@bar.com'
    ]
]);

Getting a lead

$lead = $client->leads()->show('fooemail@bar.com'); // outputs an object with all valid information on the lead

$lead->email; // outputs 'fooemail@bar.com'

Triggering a campaign

To trigger a campaign, provide the campaign id, the email of the lead that will receive the campaign email, and an array of tokens (variables) for the template email belonging to the campaign

$client-campaign()
    ->trigger(1234, 'foobar@email.com',
        [
            '{{my.name}}' => 'Foo'
        ]
    );