Skip to content

Latest commit

 

History

History
543 lines (405 loc) · 23.3 KB

WhatsAppCampaignsApi.md

File metadata and controls

543 lines (405 loc) · 23.3 KB

Brevo\Client\WhatsAppCampaignsApi

All URIs are relative to https://api.brevo.com/v3

Method HTTP request Description
createWhatsAppCampaign POST /whatsappCampaigns Create and Send a WhatsApp campaign
createWhatsAppTemplate POST /whatsppCampaigns/template Create a WhatsApp template
deleteWhatsAppCampaign DELETE /whatsappCampaigns/{campaignId} Delete a WhatsApp campaign
getWhatsAppCampaign GET /whatsappCampaigns/{campaignId} Get a WhatsApp campaign
getWhatsAppCampaigns GET /whatsappCampaigns Return all your created WhatsApp campaigns
getWhatsAppConfig GET /whatsappCampaigns/config Get your WhatsApp API account information
getWhatsAppTemplates GET /whatsappCampaigns/template-list Return all your created WhatsApp templates
sendWhatsAppTemplateApproval POST /whatsappCampaigns/template/approval/{templateId} Send your WhatsApp template for approval
updateWhatsAppCampaign PUT /whatsappCampaigns/{campaignId} Update a WhatsApp campaign

createWhatsAppCampaign

\Brevo\Client\Model\CreateModel createWhatsAppCampaign($whatsAppCampaigns)

Create and Send a WhatsApp campaign

Example

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

// Configure API key authorization: api-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');

$apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi(
    // 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
);
$whatsAppCampaigns = new \Brevo\Client\Model\CreateWhatsAppCampaign(); // \Brevo\Client\Model\CreateWhatsAppCampaign | Values to create a campaign

try {
    $result = $apiInstance->createWhatsAppCampaign($whatsAppCampaigns);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WhatsAppCampaignsApi->createWhatsAppCampaign: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
whatsAppCampaigns \Brevo\Client\Model\CreateWhatsAppCampaign Values to create a campaign

Return type

\Brevo\Client\Model\CreateModel

Authorization

api-key, partner-key

HTTP request headers

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

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

createWhatsAppTemplate

\Brevo\Client\Model\CreateModel createWhatsAppTemplate($whatsAppTemplates)

Create a WhatsApp template

Example

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

// Configure API key authorization: api-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');

$apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi(
    // 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
);
$whatsAppTemplates = new \Brevo\Client\Model\CreateWhatsAppTemplate(); // \Brevo\Client\Model\CreateWhatsAppTemplate | Values to create a template

try {
    $result = $apiInstance->createWhatsAppTemplate($whatsAppTemplates);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WhatsAppCampaignsApi->createWhatsAppTemplate: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
whatsAppTemplates \Brevo\Client\Model\CreateWhatsAppTemplate Values to create a template

Return type

\Brevo\Client\Model\CreateModel

Authorization

api-key, partner-key

HTTP request headers

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

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

deleteWhatsAppCampaign

deleteWhatsAppCampaign($campaignId)

Delete a WhatsApp campaign

Example

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

// Configure API key authorization: api-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');

$apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi(
    // 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
);
$campaignId = 789; // int | id of the campaign

try {
    $apiInstance->deleteWhatsAppCampaign($campaignId);
} catch (Exception $e) {
    echo 'Exception when calling WhatsAppCampaignsApi->deleteWhatsAppCampaign: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
campaignId int id of the campaign

Return type

void (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

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

getWhatsAppCampaign

\Brevo\Client\Model\GetWhatsappCampaignOverview getWhatsAppCampaign($campaignId)

Get a WhatsApp campaign

Example

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

// Configure API key authorization: api-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');

$apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi(
    // 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
);
$campaignId = 789; // int | Id of the campaign

try {
    $result = $apiInstance->getWhatsAppCampaign($campaignId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WhatsAppCampaignsApi->getWhatsAppCampaign: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
campaignId int Id of the campaign

Return type

\Brevo\Client\Model\GetWhatsappCampaignOverview

Authorization

api-key, partner-key

HTTP request headers

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

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

getWhatsAppCampaigns

\Brevo\Client\Model\GetWhatsappCampaigns getWhatsAppCampaigns($startDate, $endDate, $limit, $offset, $sort)

Return all your created WhatsApp campaigns

Example

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

// Configure API key authorization: api-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');

$apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi(
    // 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
);
$startDate = "startDate_example"; // string | **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result**
$endDate = "endDate_example"; // string | **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. **Prefer to pass your timezone in date-time format for accurate result**
$limit = 50; // int | Number of documents per page
$offset = 0; // int | Index of the first document in the page
$sort = "desc"; // string | Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed

try {
    $result = $apiInstance->getWhatsAppCampaigns($startDate, $endDate, $limit, $offset, $sort);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WhatsAppCampaignsApi->getWhatsAppCampaigns: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
startDate string Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. Prefer to pass your timezone in date-time format for accurate result [optional]
endDate string Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the campaigns created. Prefer to pass your timezone in date-time format for accurate result [optional]
limit int Number of documents per page [optional] [default to 50]
offset int Index of the first document in the page [optional] [default to 0]
sort string Sort the results in the ascending/descending order of record modification. Default order is descending if `sort` is not passed [optional] [default to desc]

Return type

\Brevo\Client\Model\GetWhatsappCampaigns

Authorization

api-key, partner-key

HTTP request headers

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

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

getWhatsAppConfig

\Brevo\Client\Model\GetWhatsAppConfig getWhatsAppConfig()

Get your WhatsApp API account information

Example

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

// Configure API key authorization: api-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');

$apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi(
    // 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
);

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

Parameters

This endpoint does not need any parameter.

Return type

\Brevo\Client\Model\GetWhatsAppConfig

Authorization

api-key, partner-key

HTTP request headers

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

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

getWhatsAppTemplates

\Brevo\Client\Model\GetWATemplates getWhatsAppTemplates($startDate, $endDate, $limit, $offset, $sort, $source)

Return all your created WhatsApp templates

Example

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

// Configure API key authorization: api-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');

$apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi(
    // 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
);
$startDate = "startDate_example"; // string | **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result**
$endDate = "endDate_example"; // string | **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. **Prefer to pass your timezone in date-time format for accurate result**
$limit = 50; // int | Number of documents per page
$offset = 0; // int | Index of the first document in the page
$sort = "desc"; // string | Sort the results in the ascending/descending order of record modification. Default order is **descending** if `sort` is not passed
$source = "source_example"; // string | source of the template

try {
    $result = $apiInstance->getWhatsAppTemplates($startDate, $endDate, $limit, $offset, $sort, $source);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling WhatsAppCampaignsApi->getWhatsAppTemplates: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
startDate string Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. Prefer to pass your timezone in date-time format for accurate result [optional]
endDate string Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the templates created. Prefer to pass your timezone in date-time format for accurate result [optional]
limit int Number of documents per page [optional] [default to 50]
offset int Index of the first document in the page [optional] [default to 0]
sort string Sort the results in the ascending/descending order of record modification. Default order is descending if `sort` is not passed [optional] [default to desc]
source string source of the template [optional]

Return type

\Brevo\Client\Model\GetWATemplates

Authorization

api-key, partner-key

HTTP request headers

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

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

sendWhatsAppTemplateApproval

sendWhatsAppTemplateApproval($templateId)

Send your WhatsApp template for approval

Example

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

// Configure API key authorization: api-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');

$apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi(
    // 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
);
$templateId = 789; // int | id of the campaign

try {
    $apiInstance->sendWhatsAppTemplateApproval($templateId);
} catch (Exception $e) {
    echo 'Exception when calling WhatsAppCampaignsApi->sendWhatsAppTemplateApproval: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
templateId int id of the campaign

Return type

void (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

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

updateWhatsAppCampaign

updateWhatsAppCampaign($campaignId, $whatsAppCampaign)

Update a WhatsApp campaign

Example

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

// Configure API key authorization: api-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');
// Configure API key authorization: partner-key
$config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer');

$apiInstance = new Brevo\Client\Api\WhatsAppCampaignsApi(
    // 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
);
$campaignId = 789; // int | Id of the campaign
$whatsAppCampaign = new \Brevo\Client\Model\UpdateWhatsAppCampaign(); // \Brevo\Client\Model\UpdateWhatsAppCampaign | values to update WhatsApp Campaign

try {
    $apiInstance->updateWhatsAppCampaign($campaignId, $whatsAppCampaign);
} catch (Exception $e) {
    echo 'Exception when calling WhatsAppCampaignsApi->updateWhatsAppCampaign: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
campaignId int Id of the campaign
whatsAppCampaign \Brevo\Client\Model\UpdateWhatsAppCampaign values to update WhatsApp Campaign [optional]

Return type

void (empty response body)

Authorization

api-key, partner-key

HTTP request headers

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

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