Skip to main content
Version: Next

WebhookCollectionClient

Client for managing the collection of Webhooks.

Webhooks allow you to receive notifications when specific events occur in your Actors or tasks. This client provides methods to list and create webhooks for specific Actors or tasks.

@example
const client = new ApifyClient({ token: 'my-token' });

// List webhooks for an Actor
const actorWebhooksClient = client.actor('my-actor-id').webhooks();
const { items } = await actorWebhooksClient.list();

// Create a webhook
const newWebhook = await actorWebhooksClient.create({
eventTypes: ['ACTOR.RUN.SUCCEEDED'],
requestUrl: 'https://example.com/webhook'
});
@see

Hierarchy

  • ResourceCollectionClient
    • WebhookCollectionClient

Index

Properties

inheritedapifyClient

apifyClient: ApifyClient

inheritedbaseUrl

baseUrl: string

inheritedhttpClient

httpClient: HttpClient

optionalinheritedid

id?: string

optionalinheritedparams

params?: Record<string, unknown>

inheritedpublicBaseUrl

publicBaseUrl: string

inheritedresourcePath

resourcePath: string

optionalinheritedsafeId

safeId?: string

inheritedurl

url: string

Methods

create

list

  • list(options): PaginatedIterator<Omit<Webhook, payloadTemplate | headersTemplate>>
  • Lists all Webhooks.

    Awaiting the return value (as you would with a Promise) will result in a single API call. The amount of fetched items in a single API call is limited.

    const paginatedList = await client.list(options);

    Asynchronous iteration is also supported. This will fetch additional pages if needed until all items are retrieved.

    for await (const singleItem of client.list(options)) {...}
    @see

    Parameters

    Returns PaginatedIterator<Omit<Webhook, payloadTemplate | headersTemplate>>

    A paginated iterator of webhooks.