PHP code example of linkage / sendgrid-marketing-campaign-api-client

1. Go to this page and download the library: Download linkage/sendgrid-marketing-campaign-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

linkage / sendgrid-marketing-campaign-api-client example snippets



$apiKey = 'get your api key from sendgrid admin screen';

$sendgridClient = new \Linkage\SendgridMarketingCampaignApiClient\Client(
    new \Linkage\SendgridMarketingCampaignApiClient\SendgridApiRequester($apiKey),
);
try {
    $sendgridClient->createContactList(
        new \Linkage\SendgridMarketingCampaignApiClient\ContactList\CreateContactListRequest('my new contact list'),
    );
} catch (\Linkage\SendgridMarketingCampaignApiClient\SendgridApiClientException $e) {
    // handle client error
} catch (\Linkage\SendgridMarketingCampaignApiClient\SendgridApiServerException $e) {
    // handle server error
}