WebhooksLogs extends WebhooksModel
Webhook Logs
Table of Contents
Methods
| deleteLogs() | Deletes webhook logs older than the given date |
| getAllLogs() | Fetch all logs across all webhooks |
| getAllLogsCount() | Fetch the number of all logs available across all webhooks |
| getLog() | Fetch a webhook log |
| getLogs() | Fetch the logs for a webhook |
| getLogsCount() | Fetch the number of logs available for a webhook |
| log() | Logs a webhook event |
| retryLog() | Retry an outgoing webhook |
Methods
deleteLogs()
Deletes webhook logs older than the given date
public
deleteLogs(string $date) : int
Parameters
- $date : string
-
The date before which to delete logs
Return values
int —The number of logs deleted
getAllLogs()
Fetch all logs across all webhooks
public
getAllLogs([array<string|int, mixed> $filters = [] ][, int $page = 1 ][, array<string|int, mixed> $order_by = ['id' => 'DESC'] ]) : mixed
Parameters
- $filters : array<string|int, mixed> = []
-
An array of filters including:
- webhook_id The ID of the webhook to filter by (optional)
- event The event name to filter by (optional)
- http_response The HTTP response code to filter by (optional)
- date_start The start date to filter by (optional)
- date_end The end date to filter by (optional)
- $page : int = 1
-
The page to return results for (optional, default 1)
- $order_by : array<string|int, mixed> = ['id' => 'DESC']
-
The order by clause (optional, default ['id' => 'DESC'])
Return values
mixed —An array of objects, each one representing a logged request
getAllLogsCount()
Fetch the number of all logs available across all webhooks
public
getAllLogsCount([array<string|int, mixed> $filters = [] ]) : int
Parameters
- $filters : array<string|int, mixed> = []
-
An array of filters including:
- webhook_id The ID of the webhook to filter by (optional)
- event The event name to filter by (optional)
- http_response The HTTP response code to filter by (optional)
- date_start The start date to filter by (optional)
- date_end The end date to filter by (optional)
Return values
int —The number representing the total number of logs
getLog()
Fetch a webhook log
public
getLog(int $id) : mixed
Parameters
- $id : int
-
The ID of the webhook to fetch the logs
Return values
mixed —An object representing a logged request
getLogs()
Fetch the logs for a webhook
public
getLogs(int $webhook_id[, int $page = 1 ][, array<string|int, mixed> $order_by = ['id' => 'DESC'] ]) : mixed
Parameters
- $webhook_id : int
-
The ID of the webhook to fetch the logs
- $page : int = 1
-
The page to return results for (optional, default 1)
- $order_by : array<string|int, mixed> = ['id' => 'DESC']
-
The order by clause (optional, default ['id' => 'DESC'])
Return values
mixed —An array of objects, each one representing a logged request
getLogsCount()
Fetch the number of logs available for a webhook
public
getLogsCount(int $webhook_id) : int
Parameters
- $webhook_id : int
-
The ID of the webhook to fetch the logs
Return values
int —The number representing the total number of logs for this webhook
log()
Logs a webhook event
public
log(array<string|int, mixed> $vars) : mixed
Parameters
- $vars : array<string|int, mixed>
-
An array containing the webhook information to log:
- staff_id The ID of the staff member who manually triggered the webhook (optional)
- webhook_id The ID of the webhook associated to this log
- event The event triggered by the webhook
- fields An array of fields sent by the webhook
- response The raw response returned by the callback
- http_response The HTTP response from the callback
retryLog()
Retry an outgoing webhook
public
retryLog(int $log_id) : mixed
Parameters
- $log_id : int
-
The ID of the webhook to be retried
Return values
mixed —An object representing a logged request