Skip to content

Latest commit

 

History

History
550 lines (376 loc) · 15.6 KB

File metadata and controls

550 lines (376 loc) · 15.6 KB

Keap\Core\V2\EmailApi

All URIs are relative to https://api.keap.com/crm, except if the operation defines another base path.

Method HTTP request Description
createEmail() POST /rest/v2/emails Create an Email Record
createEmails() POST /rest/v2/emails:batchAdd Create a set of Email Records
deleteEmail() DELETE /rest/v2/emails/{id} Delete an Email Record
deleteEmails() POST /rest/v2/emails:batchRemove Remove a set of Email Records
getEmail() GET /rest/v2/emails/{id} Retrieve an Email
getEmailTemplate() GET /rest/v2/emails/templates/{email_template_id} Retrieve an email template
listEmails() GET /rest/v2/emails List Emails
sendEmail() POST /rest/v2/emails:send Send an Email
sendEmailTemplate() POST /rest/v2/emails/templates:send Send an email based on a template

createEmail()

createEmail($create_email_sent_request): \Keap\Core\V2\Model\EmailSentWithContent

Create an Email Record

Creates a Record of an Email sent to a Contact

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\EmailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$create_email_sent_request = new \Keap\Core\V2\Model\CreateEmailSentRequest(); // \Keap\Core\V2\Model\CreateEmailSentRequest

try {
    $result = $apiInstance->createEmail($create_email_sent_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling EmailApi->createEmail: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
create_email_sent_request \Keap\Core\V2\Model\CreateEmailSentRequest

Return type

\Keap\Core\V2\Model\EmailSentWithContent

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createEmails()

createEmails($create_emails_sent_request): \Keap\Core\V2\Model\EmailsSentList

Create a set of Email Records

Creates a set of Records of Emails sent to Contacts, maximum 1000 per transaction.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\EmailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$create_emails_sent_request = new \Keap\Core\V2\Model\CreateEmailsSentRequest(); // \Keap\Core\V2\Model\CreateEmailsSentRequest

try {
    $result = $apiInstance->createEmails($create_emails_sent_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling EmailApi->createEmails: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
create_emails_sent_request \Keap\Core\V2\Model\CreateEmailsSentRequest

Return type

\Keap\Core\V2\Model\EmailsSentList

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteEmail()

deleteEmail($id)

Delete an Email Record

Deletes a specific Email Record

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\EmailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$id = 'id_example'; // string

try {
    $apiInstance->deleteEmail($id);
} catch (Exception $e) {
    echo 'Exception when calling EmailApi->deleteEmail: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
id string

Return type

void (empty response body)

Authorization

oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteEmails()

deleteEmails($delete_emails_request): \Keap\Core\V2\Model\DeleteEmailsResponse

Remove a set of Email Records

Removes a set of Email Records

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\EmailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$delete_emails_request = new \Keap\Core\V2\Model\DeleteEmailsRequest(); // \Keap\Core\V2\Model\DeleteEmailsRequest

try {
    $result = $apiInstance->deleteEmails($delete_emails_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling EmailApi->deleteEmails: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
delete_emails_request \Keap\Core\V2\Model\DeleteEmailsRequest

Return type

\Keap\Core\V2\Model\DeleteEmailsResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getEmail()

getEmail($id): \Keap\Core\V2\Model\EmailSentWithContent

Retrieve an Email

Retrieves a single Email that has been sent

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\EmailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$id = 'id_example'; // string

try {
    $result = $apiInstance->getEmail($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling EmailApi->getEmail: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
id string

Return type

\Keap\Core\V2\Model\EmailSentWithContent

Authorization

oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getEmailTemplate()

getEmailTemplate($email_template_id): \Keap\Core\V2\Model\EmailTemplate

Retrieve an email template

Retrieve an email template

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\EmailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$email_template_id = 'email_template_id_example'; // string

try {
    $result = $apiInstance->getEmailTemplate($email_template_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling EmailApi->getEmailTemplate: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
email_template_id string

Return type

\Keap\Core\V2\Model\EmailTemplate

Authorization

oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listEmails()

listEmails($filter, $order_by, $page_size, $page_token): \Keap\Core\V2\Model\ListEmailsSentResponse

List Emails

Retrieves a list of emails that have been sent

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\EmailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$filter = 'filter_example'; // string | Filter to apply, allowed fields are: - (String) contact_id - (String) email - (String) start_created_time - (String) end_created_time
$order_by = 'order_by_example'; // string | Attribute and direction to order items. One of the following fields: - `created_time`  One of the following directions: - `asc` - `desc`
$page_size = 0; // int | Total number of items to return per page
$page_token = 'page_token_example'; // string | Page token

try {
    $result = $apiInstance->listEmails($filter, $order_by, $page_size, $page_token);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling EmailApi->listEmails: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
filter string Filter to apply, allowed fields are: - (String) contact_id - (String) email - (String) start_created_time - (String) end_created_time [optional]
order_by string Attribute and direction to order items. One of the following fields: - `created_time` One of the following directions: - `asc` - `desc` [optional]
page_size int Total number of items to return per page [optional]
page_token string Page token [optional]

Return type

\Keap\Core\V2\Model\ListEmailsSentResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

sendEmail()

sendEmail($email_send_request)

Send an Email

Sends an Email to a list of Contacts

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\EmailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$email_send_request = new \Keap\Core\V2\Model\EmailSendRequest(); // \Keap\Core\V2\Model\EmailSendRequest

try {
    $apiInstance->sendEmail($email_send_request);
} catch (Exception $e) {
    echo 'Exception when calling EmailApi->sendEmail: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
email_send_request \Keap\Core\V2\Model\EmailSendRequest

Return type

void (empty response body)

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

sendEmailTemplate()

sendEmailTemplate($email_send_template_request)

Send an email based on a template

Send an email based on a template

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure OAuth2 access token for authorization: oauth2
$config = Keap\Core\V2\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Keap\Core\V2\Api\EmailApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$email_send_template_request = new \Keap\Core\V2\Model\EmailSendTemplateRequest(); // \Keap\Core\V2\Model\EmailSendTemplateRequest

try {
    $apiInstance->sendEmailTemplate($email_send_template_request);
} catch (Exception $e) {
    echo 'Exception when calling EmailApi->sendEmailTemplate: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
email_send_template_request \Keap\Core\V2\Model\EmailSendTemplateRequest

Return type

void (empty response body)

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]