Skip to content

Webhook management

Create

Create webhook

python
from subgatekit import EventCode, Webhook

webhook = Webhook(
    event_code=EventCode.SubCreated,
    target_url="http://my-site.com",
)
client.webhook_client().create(webhook)

Retrieve

Get webhook by id

python
from uuid import UUID

target_id: UUID = fake_webhook.id
webhook = client.webhook_client().get_by_id(target_id)

Get all webhooks

python
webhooks = client.webhook_client().get_all()

Update

Update webhook

python
from uuid import UUID
from subgatekit import EventCode

target_id: UUID = fake_webhook.id
webhook = client.webhook_client().get_by_id(target_id)

webhook.target_url = "http://updated-site.com"
webhook.event_code = EventCode.SubExpired
client.webhook_client().update(webhook)

Delete

Delete webhook by id

python
from uuid import UUID

target_id: UUID = fake_webhook.id
client.webhook_client().delete_by_id(target_id)

Delete all webhooks

python
client.webhook_client().delete_all()