All URIs are relative to https://api.brevo.com/v3
Method | HTTP request | Description |
---|---|---|
getWhatsappEventReport | GET /whatsapp/statistics/events | Get all your WhatsApp activity (unaggregated events) |
sendWhatsappMessage | POST /whatsapp/sendMessage | Send a WhatsApp message |
\Brevo\Client\Model\GetWhatsappEventReport getWhatsappEventReport($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort)
Get all your WhatsApp activity (unaggregated events)
This endpoint will show the unaggregated statistics for WhatsApp activity (30 days by default if startDate
and endDate
or days
is not passed. The date range can not exceed 90 days)
<?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\TransactionalWhatsAppApi(
// 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
);
$limit = 2500; // int | Number limitation for the result returned
$offset = 0; // int | Beginning point in the list to retrieve from
$startDate = "startDate_example"; // string | **Mandatory if endDate is used.** Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate
$endDate = "endDate_example"; // string | **Mandatory if startDate is used.** Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate
$days = 789; // int | Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_
$contactNumber = "contactNumber_example"; // string | Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721)
$event = "event_example"; // string | Filter the report for a specific event type
$sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
try {
$result = $apiInstance->getWhatsappEventReport($limit, $offset, $startDate, $endDate, $days, $contactNumber, $event, $sort);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling TransactionalWhatsAppApi->getWhatsappEventReport: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
limit | int | Number limitation for the result returned | [optional] [default to 2500] |
offset | int | Beginning point in the list to retrieve from | [optional] [default to 0] |
startDate | string | Mandatory if endDate is used. Starting date of the report (YYYY-MM-DD). Must be lower than equal to endDate | [optional] |
endDate | string | Mandatory if startDate is used. Ending date of the report (YYYY-MM-DD). Must be greater than equal to startDate | [optional] |
days | int | Number of days in the past including today (positive integer). Not compatible with 'startDate' and 'endDate' | [optional] |
contactNumber | string | Filter results for specific contact (WhatsApp Number with country code. Example, 85264318721) | [optional] |
event | string | Filter the report for a specific event type | [optional] |
sort | string | Sort the results in the ascending/descending order of record creation. Default order is descending if `sort` is not passed | [optional] [default to desc] |
\Brevo\Client\Model\GetWhatsappEventReport
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\Brevo\Client\Model\InlineResponse2014 sendWhatsappMessage($sendWhatsappMessage)
Send a WhatsApp message
This endpoint is used to send a WhatsApp message.
(The first message you send using the API must contain a Template ID. You must create a template on WhatsApp on the Brevo platform to fetch the Template ID.)
<?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\TransactionalWhatsAppApi(
// 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
);
$sendWhatsappMessage = new \Brevo\Client\Model\SendWhatsappMessage(); // \Brevo\Client\Model\SendWhatsappMessage | Values to send WhatsApp message
try {
$result = $apiInstance->sendWhatsappMessage($sendWhatsappMessage);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling TransactionalWhatsAppApi->sendWhatsappMessage: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
sendWhatsappMessage | \Brevo\Client\Model\SendWhatsappMessage | Values to send WhatsApp message |
\Brevo\Client\Model\InlineResponse2014
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]