Channels_Management_Webhook
Class Channels_Management_Webhook
Sets up the webhook that runs on channels changes.
- Full name: \BigCommerce\Webhooks\Product\Channels_Management_Webhook
- Parent class: \BigCommerce\Webhooks\Webhook
Constants
| Constant | Visibility | Type | Value | 
|---|---|---|---|
| SCOPE | public | ’store/channel/*‘ | |
| CHANNEL_UPDATED_SCOPE | public | ’store/channel/updated’ | |
| CHANNEL_UPDATED_HOOK | public | ’bigcommerce/webhooks/channel_updated’ | |
| NAME | public | ’bigcommerce_channels’ | |
| PRODUCT_CATEGORY_CHANNEL_HOOK | public | ’bigcommerce/webhooks/product_category_channel’ | |
| PRODUCT_CHANNEL_HOOK | public | ’bigcommerce/webhooks/product_channel’ | |
| CHANNEL_CURRENCY_UPDATE_HOOK | public | ’bigcommerce/webhooks/channel_default_currency_updated’ | 
Methods
trigger_action
Fires when a change is applied to channels
public trigger_action(array $request): voidParameters:
| Parameter | Type | Description | 
|---|---|---|
| $request | array | 
handle_channels_webhooks_filters
public handle_channels_webhooks_filters(array $request, string $scope, int $channel_id, string $action): voidParameters:
| Parameter | Type | Description | 
|---|---|---|
| $request | array | |
| $scope | string | |
| $channel_id | int | |
| $action | string | 
Inherited methods
__construct
Webhook constructor
public __construct(\BigCommerce\Api\Webhooks_Api $api_client): mixedParameters:
| Parameter | Type | Description | 
|---|---|---|
| $api_client | \BigCommerce\Api\Webhooks_Api | The client for making requests. | 
get_name
public get_name(): mixedget_auth_header
Returns the value of the auth header.
public get_auth_header(): string|bool|nullReturn Value:
The value, or false or null if filter_input fails.
create
Sends a request to BigCommerce to create a webhook.
public create(array $args): arrayParameters:
| Parameter | Type | Description | 
|---|---|---|
| $args | array | Request arguments. | 
Return Value:
Webhook data or an error response on failure.
is_webhook_exist
Check by destination and scope if webhook is already added to BigCommerce.
public is_webhook_exist(): mixed|nullReturns the id of the webhook
update
Sends a request to the BC API to update a webhook. Creates it if it doesn’t exist.
public update(): mixedupdate_webhook
Send API request to update the webhook data
public update_webhook(mixed $id, mixed $data): mixedParameters:
| Parameter | Type | Description | 
|---|---|---|
| $id | mixed | |
| $data | mixed | 
destination
public destination(): mixedscope
public scope(): mixeddelete
Deletes a webhook from the BigCommerce database.
public delete(int $webhook_id): mixedParameters:
| Parameter | Type | Description | 
|---|---|---|
| $webhook_id | int | The BC ID for the webhook entry. | 
validate
Validates an incoming request.
public validate(array $request, string|bool|null $password = null): bool|\WP_ErrorParameters:
| Parameter | Type | Description | 
|---|---|---|
| $request | array | Request data. | 
| $password | string|bool|null | The password to authenticate with. | 
Return Value:
True on validation or a WP_Error if the request isn’t valid.
get_webhook_payload
Get JSON input submitted from BigCommerce.
public get_webhook_payload(): arrayReturn Value:
JSON data converted to an array.
receive
Handles a webhook request.
public receive(): mixedtrigger_action
Triggers an action based on the webhook type and the request payload
protected trigger_action(array $request): void- This method is abstract.
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $request | array | 
Automatically generated on 2025-01-21