Snippets assume $client = new ApifyClient('my-api-token'); and imported types.
list(?ListOptions $options = null): PaginationListiterate(?ListOptions $options = null, ?int $chunkSize = null): iterable— lazily iterate all webhooks, paging on demand. The options'limitcaps the total number yielded across all pages (unset = all);$chunkSizeis the per-page size.create(mixed $webhook): Webhook
Webhooks nested under an Actor or task ($client->actor($id)->webhooks(),
$client->task($id)->webhooks()) are read-only — they support list(...) and iterate(...)
only. Create webhooks through the account-wide collection, targeting an Actor or task via the
webhook's condition.
$webhook = $client->webhooks()->create([
'eventTypes' => ['ACTOR.RUN.SUCCEEDED'],
'condition' => ['actorId' => 'ACTOR_ID'],
'requestUrl' => 'https://example.com/webhook',
]);get(): ?Webhook,update(mixed $newFields): Webhook,delete(): voidtest(): WebhookDispatch— dispatch immediately.dispatches(): WebhookDispatchCollectionClient
$dispatch = $client->webhook('WEBHOOK_ID')->test();
$client->webhook('WEBHOOK_ID')->dispatches()->list(new ListOptions(limit: 10));- Collection:
list(?ListOptions $options = null): PaginationList,iterate(?ListOptions $options = null, ?int $chunkSize = null): iterable— lazily iterate all dispatches, paging on demand (options'limitcaps the total;$chunkSizeis the per-page size). - Single:
get(): ?WebhookDispatch.
$page = $client->webhookDispatches()->list(new ListOptions(limit: 5));
$dispatch = $client->webhookDispatch('DISPATCH_ID')->get();
foreach ($client->webhookDispatches()->iterate(new ListOptions(), 50) as $d) {
echo $d->getId() . PHP_EOL;
}