(webhook->webhooks)
- create - Create webhook subscription
- list - List webhook subscriptions
- delete - Delete webhook subscription
- get - Get webhook subscription
- update - Update webhook subscription
Create a webhook subscription to receive events
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$createWebhookRequest = new Components\CreateWebhookRequest(
unifiedApi: Components\UnifiedApiId::Crm,
status: Components\Status::Enabled,
deliveryUrl: 'https://example.com/my/webhook/endpoint',
events: [
Components\WebhookEventType::VaultConnectionCreated,
Components\WebhookEventType::VaultConnectionUpdated,
],
description: 'A description',
);
$response = $sdk->webhook->webhooks->create(
createWebhookRequest: $createWebhookRequest,
appId: 'dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX'
);
if ($response->createWebhookResponse !== null) {
// handle response
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
createWebhookRequest |
Components\CreateWebhookRequest | ✔️ | N/A | |
appId |
?string | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
?Operations\WebhookWebhooksAddResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
List all webhook subscriptions
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$responses = $sdk->webhook->webhooks->list(
appId: 'dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX',
limit: 20,
cursor: '<value>'
);
foreach ($responses as $response) {
if ($response->httpMeta->response->getStatusCode() === 200) {
// handle response
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
appId |
?string | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
limit |
?int | ➖ | Number of results to return. Minimum 1, Maximum 200, Default 20 | |
cursor |
?string | ➖ | Cursor to start from. You can find cursors for next/previous pages in the meta.cursors property of the response. |
?Operations\WebhookWebhooksAllResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Delete a webhook subscription
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$response = $sdk->webhook->webhooks->delete(
id: '<id>',
appId: 'dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX'
);
if ($response->deleteWebhookResponse !== null) {
// handle response
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
string | ✔️ | JWT Webhook token that represents the unifiedApi and applicationId associated to the event source. | |
appId |
?string | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
?Operations\WebhookWebhooksDeleteResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Get the webhook subscription details
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$response = $sdk->webhook->webhooks->get(
id: '<id>',
appId: 'dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX'
);
if ($response->getWebhookResponse !== null) {
// handle response
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
string | ✔️ | JWT Webhook token that represents the unifiedApi and applicationId associated to the event source. | |
appId |
?string | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
?Operations\WebhookWebhooksOneResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Update a webhook subscription
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$updateWebhookRequest = new Components\UpdateWebhookRequest(
status: Components\Status::Enabled,
deliveryUrl: 'https://example.com/my/webhook/endpoint',
events: [
Components\WebhookEventType::VaultConnectionCreated,
Components\WebhookEventType::VaultConnectionUpdated,
],
description: 'A description',
);
$response = $sdk->webhook->webhooks->update(
id: '<id>',
updateWebhookRequest: $updateWebhookRequest,
appId: 'dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX'
);
if ($response->updateWebhookResponse !== null) {
// handle response
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
id |
string | ✔️ | JWT Webhook token that represents the unifiedApi and applicationId associated to the event source. | |
updateWebhookRequest |
Components\UpdateWebhookRequest | ✔️ | N/A | |
appId |
?string | ➖ | The ID of your Unify application | dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX |
?Operations\WebhookWebhooksUpdateResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |