Toloka documentation

upsert_webhook_subscriptions

toloka.client.TolokaClient.upsert_webhook_subscriptions | Source code

upsert_webhook_subscriptions(self, subscriptions: List[WebhookSubscription])

Creates (upsert) many webhook-subscriptions.

Parameters Description

Parameters Type Description
subscriptions List[WebhookSubscription]

List of webhook-subscriptions, that will be created.

Examples:

How to create several subscriptions.

created_result = toloka_client.upsert_webhook_subscriptions([
    {
        'webhook_url': 'https://awesome-requester.com/toloka-webhook',
        'event_type': toloka.webhook_subscription.WebhookSubscription.EventType.ASSIGNMENT_CREATED,
        'pool_id': '121212'
    },
    {
        'webhook_url': 'https://awesome-requester.com/toloka-webhook',
        'event_type': toloka.webhook_subscription.WebhookSubscription.EventType.POOL_CLOSED,
        'pool_id': '121212',
    }
])
print(len(created_result.items))