src/Api/CampaignApi.php
public function trigger($campaignId, $email, array $tokens)
    {
        $lead = $this->client->leads()->show($email);
        $tokens = $this->parseTokens($tokens);
        $response = $this->post($this->client->url . "/rest/v1/campaigns/$campaignId/trigger.json",
            [
                'input' => [
                    'leads' => [
                        ['id' => $lead->id]
                    ],
                    'tokens' => $tokens
                ]
            ]
        );

        if (!$response->success) {
            throw new MarketoApiException('Error triggering campaign: ' . $response->errors[0]->message);
        }
    }
public function trigger($campaignId, $email, array $tokens)
    {
        $lead = $this->client->leads()->show($email);
        $tokens = $this->parseTokens($tokens);
        $response = $this->post($this->client->url . "/rest/v1/campaigns/$campaignId/trigger.json",
            [
                'input' => [
                    'leads' => [
                        ['id' => $lead->id]
                    ],
                    'tokens' => $tokens
                ]
            ]
        );

        if (!$response->success) {
            throw new MarketoApiException('Error triggering campaign: ' . $response->errors[0]->message);
        }
    }
public function trigger ( $ campaignId , $ email , array $ tokens ) { $ lead = $ this -> client -> leads ( ) -> show ( $ email ) ; $ tokens = $ this -> parseTokens ( $ tokens ) ; $ response = $ this -> post ( $ this -> client -> url . "/rest/v1/campaigns/$campaignId/trigger.json" , [ 'input' => [ 'leads' => [ [ 'id' => $ lead -> id ] ] , 'tokens' => $ tokens ] ] ) ; if ( ! $ response -> success ) { throw new MarketoApiException ( 'Error triggering campaign: ' . $ response -> errors [ 0 ] -> message ) ; } }
Trigger a campaign for a lead

@param $campaignId
@param $email
@param array $tokens
@throws MarketoApiException
Trigger a campaign for a lead