Webhooks
zenml.webhooks
Webhook provider and trusted event contracts.
Attributes
__all__ = ['BaseWebhookProvider', 'ParsedWebhookDelivery', 'ParsedWebhookEvent', 'WebhookConfiguration', 'WebhookAuthenticationError', 'WebhookEvent', 'WebhookEventHandler', 'WebhookIntakeConfig', 'WebhookIntakeResponse', 'WebhookPayloadError', 'WebhookPreValidationResult', 'WebhookProviderRegistry', 'WebhookTargetEvent', 'WebhookTriggerMatch', 'get_webhook_provider', 'webhook_provider_registry']
module-attribute
webhook_provider_registry = WebhookProviderRegistry()
module-attribute
Classes
BaseWebhookProvider
Bases: ABC
Stateless provider behavior used by intake and trigger matching.
Methods:
authenticate(body: bytes, headers: Mapping[str, str], secret: str) -> None
abstractmethod
Authenticate the exact raw request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
secret
|
str
|
The webhook signing secret. |
required |
Raises:
| Type | Description |
|---|---|
WebhookAuthenticationError
|
If authentication fails. |
Source code in src/zenml/webhooks/providers/base.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
get_delivery_id(payload: dict[str, Any], headers: Mapping[str, str]) -> str | None
Extract the optional delivery ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed JSON payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The delivery ID, if present. |
Source code in src/zenml/webhooks/providers/base.py
391 392 393 394 395 396 397 398 399 400 401 402 403 | |
get_event_type(payload: dict[str, Any], headers: Mapping[str, str]) -> str
abstractmethod
Extract the provider event type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed JSON payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The provider event type. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the type is missing or invalid. |
Source code in src/zenml/webhooks/providers/base.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
match_triggers(*, event: WebhookEvent, candidates: Sequence[WebhookTriggerResponse]) -> WebhookTriggerMatch[WebhookTriggerResponse]
abstractmethod
Match candidates and return the parsed semantic event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted webhook event. |
required |
candidates
|
Sequence[WebhookTriggerResponse]
|
Triggers selected by generic orchestration. |
required |
Returns:
| Type | Description |
|---|---|
WebhookTriggerMatch[WebhookTriggerResponse]
|
The matching triggers and any parsed semantic event. |
Source code in src/zenml/webhooks/providers/base.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
parse(body: bytes, headers: Mapping[str, str]) -> ParsedWebhookEvent
Parse a delivery into provider-neutral event data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
ParsedWebhookEvent
|
The parsed delivery. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the body or metadata is invalid. |
Source code in src/zenml/webhooks/providers/base.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
parse_delivery(body: bytes, headers: Mapping[str, str]) -> ParsedWebhookDelivery
Parse a successful delivery and select its intake response.
Existing providers can continue to implement :meth:parse; providers
with control deliveries or custom responses can override this method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
ParsedWebhookDelivery
|
The parsed delivery and provider-owned response. |
Source code in src/zenml/webhooks/providers/base.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
pre_validate(headers: Mapping[str, str]) -> WebhookPreValidationResult
async
Validate headers before webhook lookup and body reading.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
headers
|
Mapping[str, str]
|
The untrusted request headers. |
required |
Returns:
| Type | Description |
|---|---|
WebhookPreValidationResult
|
Whether generic intake should process or ignore the delivery. |
Source code in src/zenml/webhooks/providers/base.py
297 298 299 300 301 302 303 304 305 306 307 308 309 | |
validate_configuration(configuration: WebhookConfiguration | Mapping[str, Any]) -> WebhookConfiguration
Strictly validate a configuration for persistence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration
|
WebhookConfiguration | Mapping[str, Any]
|
The provider-neutral configuration. |
required |
Returns:
| Type | Description |
|---|---|
WebhookConfiguration
|
A normalized provider-neutral configuration. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If a configuration for another provider is supplied. |
Source code in src/zenml/webhooks/providers/base.py
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
ParsedWebhookDelivery
Bases: BaseModel
A successful provider delivery and its intake response.
ParsedWebhookEvent
Bases: BaseModel
Provider delivery parsed into provider-neutral metadata.
WebhookAuthenticationError(message: Optional[str] = None, url: Optional[str] = None)
Bases: CredentialsNotValid
Raised when a webhook request cannot be authenticated.
Source code in src/zenml/exceptions.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
WebhookConfiguration
WebhookEvent
WebhookEventHandler
Bases: EventHandler
Base handler for trusted webhook events.
Methods:
handle_event(event: Event) -> None
Route trusted webhook events to the specialized handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Event
|
The dispatched event envelope. |
required |
Source code in src/zenml/webhooks/handler.py
25 26 27 28 29 30 31 32 | |
handle_webhook_event(event: WebhookEvent) -> None
abstractmethod
Handle a trusted webhook event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted webhook event. |
required |
Source code in src/zenml/webhooks/handler.py
34 35 36 37 38 39 40 | |
WebhookIntakeConfig
Bases: BaseModel
Configuration required to authenticate one webhook delivery.
WebhookIntakeResponse
Bases: BaseModel
Provider-owned successful webhook intake response.
WebhookPayloadError
Bases: ValueError
Raised when a webhook payload fails fundamental validation.
WebhookPreValidationResult
WebhookProviderRegistry()
Registry for webhook provider implementations.
Initialize the webhook provider registry.
Source code in src/zenml/webhooks/providers/registry.py
27 28 29 30 31 | |
Methods:
get(webhook_type: str) -> BaseWebhookProvider
Instantiate the provider registered for a webhook type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
webhook_type
|
str
|
The webhook type identifier. |
required |
Returns:
| Type | Description |
|---|---|
BaseWebhookProvider
|
A new provider instance. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no provider is registered for the webhook type. |
Source code in src/zenml/webhooks/providers/registry.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
register(provider_class: type[BaseWebhookProvider], *, overwrite: bool = False) -> None
Register a webhook provider class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider_class
|
type[BaseWebhookProvider]
|
The provider class to register. |
required |
overwrite
|
bool
|
Whether to replace an existing registration. |
False
|
Source code in src/zenml/webhooks/providers/registry.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
register_builtin_providers() -> None
Register the built-in webhook providers once, on demand.
Source code in src/zenml/webhooks/providers/registry.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
WebhookTargetEvent
Bases: BaseModel
Shared shape of a provider-specific target event.
Methods:
validate_filters() -> WebhookTargetEvent
Validate all configured string filters.
Returns:
| Type | Description |
|---|---|
WebhookTargetEvent
|
The validated target event. |
Source code in src/zenml/webhooks/providers/base.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
WebhookTriggerMatch
Bases: BaseModel, Generic[WebhookTriggerT]
Result of matching one trusted event to webhook triggers.
Functions:
get_webhook_provider(webhook_type: str) -> BaseWebhookProvider
Get the provider registered for a webhook type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
webhook_type
|
str
|
The webhook type identifier. |
required |
Returns:
| Type | Description |
|---|---|
BaseWebhookProvider
|
A new provider instance. |
Source code in src/zenml/webhooks/providers/registry.py
105 106 107 108 109 110 111 112 113 114 | |
Modules
events
Provider-neutral trusted webhook event models.
Classes
WebhookEvent
handler
Event handler contract for trusted webhook events.
Classes
WebhookEventHandler
Bases: EventHandler
Base handler for trusted webhook events.
handle_event(event: Event) -> None
Route trusted webhook events to the specialized handler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Event
|
The dispatched event envelope. |
required |
Source code in src/zenml/webhooks/handler.py
25 26 27 28 29 30 31 32 | |
handle_webhook_event(event: WebhookEvent) -> None
abstractmethod
Handle a trusted webhook event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted webhook event. |
required |
Source code in src/zenml/webhooks/handler.py
34 35 36 37 38 39 40 | |
intake
Internal contracts for webhook intake.
Classes
WebhookIntakeConfig
Bases: BaseModel
Configuration required to authenticate one webhook delivery.
providers
Webhook provider contracts and registry.
Classes
BaseWebhookProvider
Bases: ABC
Stateless provider behavior used by intake and trigger matching.
authenticate(body: bytes, headers: Mapping[str, str], secret: str) -> None
abstractmethod
Authenticate the exact raw request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
secret
|
str
|
The webhook signing secret. |
required |
Raises:
| Type | Description |
|---|---|
WebhookAuthenticationError
|
If authentication fails. |
Source code in src/zenml/webhooks/providers/base.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
get_delivery_id(payload: dict[str, Any], headers: Mapping[str, str]) -> str | None
Extract the optional delivery ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed JSON payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The delivery ID, if present. |
Source code in src/zenml/webhooks/providers/base.py
391 392 393 394 395 396 397 398 399 400 401 402 403 | |
get_event_type(payload: dict[str, Any], headers: Mapping[str, str]) -> str
abstractmethod
Extract the provider event type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed JSON payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The provider event type. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the type is missing or invalid. |
Source code in src/zenml/webhooks/providers/base.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
match_triggers(*, event: WebhookEvent, candidates: Sequence[WebhookTriggerResponse]) -> WebhookTriggerMatch[WebhookTriggerResponse]
abstractmethod
Match candidates and return the parsed semantic event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted webhook event. |
required |
candidates
|
Sequence[WebhookTriggerResponse]
|
Triggers selected by generic orchestration. |
required |
Returns:
| Type | Description |
|---|---|
WebhookTriggerMatch[WebhookTriggerResponse]
|
The matching triggers and any parsed semantic event. |
Source code in src/zenml/webhooks/providers/base.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
parse(body: bytes, headers: Mapping[str, str]) -> ParsedWebhookEvent
Parse a delivery into provider-neutral event data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
ParsedWebhookEvent
|
The parsed delivery. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the body or metadata is invalid. |
Source code in src/zenml/webhooks/providers/base.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
parse_delivery(body: bytes, headers: Mapping[str, str]) -> ParsedWebhookDelivery
Parse a successful delivery and select its intake response.
Existing providers can continue to implement :meth:parse; providers
with control deliveries or custom responses can override this method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
ParsedWebhookDelivery
|
The parsed delivery and provider-owned response. |
Source code in src/zenml/webhooks/providers/base.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
pre_validate(headers: Mapping[str, str]) -> WebhookPreValidationResult
async
Validate headers before webhook lookup and body reading.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
headers
|
Mapping[str, str]
|
The untrusted request headers. |
required |
Returns:
| Type | Description |
|---|---|
WebhookPreValidationResult
|
Whether generic intake should process or ignore the delivery. |
Source code in src/zenml/webhooks/providers/base.py
297 298 299 300 301 302 303 304 305 306 307 308 309 | |
validate_configuration(configuration: WebhookConfiguration | Mapping[str, Any]) -> WebhookConfiguration
Strictly validate a configuration for persistence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration
|
WebhookConfiguration | Mapping[str, Any]
|
The provider-neutral configuration. |
required |
Returns:
| Type | Description |
|---|---|
WebhookConfiguration
|
A normalized provider-neutral configuration. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If a configuration for another provider is supplied. |
Source code in src/zenml/webhooks/providers/base.py
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
BuiltinWebhookType
ParsedWebhookDelivery
Bases: BaseModel
A successful provider delivery and its intake response.
ParsedWebhookEvent
Bases: BaseModel
Provider delivery parsed into provider-neutral metadata.
WebhookAuthenticationError(message: Optional[str] = None, url: Optional[str] = None)
Bases: CredentialsNotValid
Raised when a webhook request cannot be authenticated.
Source code in src/zenml/exceptions.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
WebhookConfiguration
WebhookIntakeResponse
Bases: BaseModel
Provider-owned successful webhook intake response.
WebhookPayloadError
Bases: ValueError
Raised when a webhook payload fails fundamental validation.
WebhookPreValidationResult
WebhookProviderRegistry()
Registry for webhook provider implementations.
Initialize the webhook provider registry.
Source code in src/zenml/webhooks/providers/registry.py
27 28 29 30 31 | |
get(webhook_type: str) -> BaseWebhookProvider
Instantiate the provider registered for a webhook type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
webhook_type
|
str
|
The webhook type identifier. |
required |
Returns:
| Type | Description |
|---|---|
BaseWebhookProvider
|
A new provider instance. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no provider is registered for the webhook type. |
Source code in src/zenml/webhooks/providers/registry.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
register(provider_class: type[BaseWebhookProvider], *, overwrite: bool = False) -> None
Register a webhook provider class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider_class
|
type[BaseWebhookProvider]
|
The provider class to register. |
required |
overwrite
|
bool
|
Whether to replace an existing registration. |
False
|
Source code in src/zenml/webhooks/providers/registry.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
register_builtin_providers() -> None
Register the built-in webhook providers once, on demand.
Source code in src/zenml/webhooks/providers/registry.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
WebhookTargetEvent
Bases: BaseModel
Shared shape of a provider-specific target event.
validate_filters() -> WebhookTargetEvent
Validate all configured string filters.
Returns:
| Type | Description |
|---|---|
WebhookTargetEvent
|
The validated target event. |
Source code in src/zenml/webhooks/providers/base.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
WebhookTriggerMatch
Bases: BaseModel, Generic[WebhookTriggerT]
Result of matching one trusted event to webhook triggers.
Functions:
get_webhook_provider(webhook_type: str) -> BaseWebhookProvider
Get the provider registered for a webhook type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
webhook_type
|
str
|
The webhook type identifier. |
required |
Returns:
| Type | Description |
|---|---|
BaseWebhookProvider
|
A new provider instance. |
Source code in src/zenml/webhooks/providers/registry.py
105 106 107 108 109 110 111 112 113 114 | |
Modules
base
Shared contracts for stateless webhook providers.
BaseWebhookProvider
Bases: ABC
Stateless provider behavior used by intake and trigger matching.
authenticate(body: bytes, headers: Mapping[str, str], secret: str) -> None
abstractmethod
Authenticate the exact raw request body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
secret
|
str
|
The webhook signing secret. |
required |
Raises:
| Type | Description |
|---|---|
WebhookAuthenticationError
|
If authentication fails. |
Source code in src/zenml/webhooks/providers/base.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
get_delivery_id(payload: dict[str, Any], headers: Mapping[str, str]) -> str | None
Extract the optional delivery ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed JSON payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The delivery ID, if present. |
Source code in src/zenml/webhooks/providers/base.py
391 392 393 394 395 396 397 398 399 400 401 402 403 | |
get_event_type(payload: dict[str, Any], headers: Mapping[str, str]) -> str
abstractmethod
Extract the provider event type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed JSON payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The provider event type. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the type is missing or invalid. |
Source code in src/zenml/webhooks/providers/base.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
match_triggers(*, event: WebhookEvent, candidates: Sequence[WebhookTriggerResponse]) -> WebhookTriggerMatch[WebhookTriggerResponse]
abstractmethod
Match candidates and return the parsed semantic event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted webhook event. |
required |
candidates
|
Sequence[WebhookTriggerResponse]
|
Triggers selected by generic orchestration. |
required |
Returns:
| Type | Description |
|---|---|
WebhookTriggerMatch[WebhookTriggerResponse]
|
The matching triggers and any parsed semantic event. |
Source code in src/zenml/webhooks/providers/base.py
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
parse(body: bytes, headers: Mapping[str, str]) -> ParsedWebhookEvent
Parse a delivery into provider-neutral event data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
ParsedWebhookEvent
|
The parsed delivery. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the body or metadata is invalid. |
Source code in src/zenml/webhooks/providers/base.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | |
parse_delivery(body: bytes, headers: Mapping[str, str]) -> ParsedWebhookDelivery
Parse a successful delivery and select its intake response.
Existing providers can continue to implement :meth:parse; providers
with control deliveries or custom responses can override this method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
ParsedWebhookDelivery
|
The parsed delivery and provider-owned response. |
Source code in src/zenml/webhooks/providers/base.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
pre_validate(headers: Mapping[str, str]) -> WebhookPreValidationResult
async
Validate headers before webhook lookup and body reading.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
headers
|
Mapping[str, str]
|
The untrusted request headers. |
required |
Returns:
| Type | Description |
|---|---|
WebhookPreValidationResult
|
Whether generic intake should process or ignore the delivery. |
Source code in src/zenml/webhooks/providers/base.py
297 298 299 300 301 302 303 304 305 306 307 308 309 | |
validate_configuration(configuration: WebhookConfiguration | Mapping[str, Any]) -> WebhookConfiguration
Strictly validate a configuration for persistence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration
|
WebhookConfiguration | Mapping[str, Any]
|
The provider-neutral configuration. |
required |
Returns:
| Type | Description |
|---|---|
WebhookConfiguration
|
A normalized provider-neutral configuration. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If a configuration for another provider is supplied. |
Source code in src/zenml/webhooks/providers/base.py
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
ParsedWebhookDelivery
Bases: BaseModel
A successful provider delivery and its intake response.
ParsedWebhookEvent
Bases: BaseModel
Provider delivery parsed into provider-neutral metadata.
WebhookAuthenticationError(message: Optional[str] = None, url: Optional[str] = None)
Bases: CredentialsNotValid
Raised when a webhook request cannot be authenticated.
Source code in src/zenml/exceptions.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
WebhookConfiguration
WebhookIntakeResponse
Bases: BaseModel
Provider-owned successful webhook intake response.
WebhookPayloadError
Bases: ValueError
Raised when a webhook payload fails fundamental validation.
WebhookPreValidationResult
WebhookTargetEvent
Bases: BaseModel
Shared shape of a provider-specific target event.
validate_filters() -> WebhookTargetEvent
Validate all configured string filters.
Returns:
| Type | Description |
|---|---|
WebhookTargetEvent
|
The validated target event. |
Source code in src/zenml/webhooks/providers/base.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
WebhookTriggerMatch
Bases: BaseModel, Generic[WebhookTriggerT]
Result of matching one trusted event to webhook triggers.
authenticate_hmac_sha256(*, body: bytes, headers: Mapping[str, str], secret: str, header: str, prefixed: bool = True) -> None
Authenticate an HMAC-SHA256 signature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The exact request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
secret
|
str
|
The signing secret. |
required |
header
|
str
|
The signature header name. |
required |
prefixed
|
bool
|
If |
True
|
Raises:
| Type | Description |
|---|---|
WebhookAuthenticationError
|
If the signature is invalid. |
Source code in src/zenml/webhooks/providers/base.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
matches_string_collection_filter(*, actual: Sequence[str], configured: StringFilterOption) -> bool
Match a collection against a configured string filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actual
|
Sequence[str]
|
Values extracted from the webhook event. |
required |
configured
|
StringFilterOption
|
The configured string filter or OR-list of filters. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether any value satisfies a positive filter or every value satisfies |
bool
|
a negative filter. |
Source code in src/zenml/webhooks/providers/base.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
matches_string_filter(*, actual: str | None, configured: StringFilterOption) -> bool
Match an extracted value against a supported string filter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actual
|
str | None
|
The value extracted from the webhook event. |
required |
configured
|
StringFilterOption
|
The configured string filter or OR-list of filters. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the extracted value matches the configured filter. |
Source code in src/zenml/webhooks/providers/base.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
clickup
ClickUp webhook provider and semantic target event catalog.
ClickUpListCreatedEvent
ClickUpListDeletedEvent
ClickUpListSemanticEvent
Bases: ClickUpSemanticEvent
Normalized ClickUp list event with shared location filters.
matches(target: ClickUpWebhookTargetEvent) -> bool
Return whether this event matches a typed list target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
ClickUpWebhookTargetEvent
|
The typed target event configuration. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this event matches the target. |
Source code in src/zenml/webhooks/providers/clickup.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
ClickUpListUpdatedEvent
ClickUpSemanticEvent
Bases: BaseModel
Normalized ClickUp event used for trigger matching.
matches(target: ClickUpWebhookTargetEvent) -> bool
abstractmethod
Return whether the semantic event matches its typed target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
ClickUpWebhookTargetEvent
|
The typed target event configuration. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the semantic event matches the target. |
Source code in src/zenml/webhooks/providers/clickup.py
312 313 314 315 316 317 318 319 320 321 | |
ClickUpTaskAssigneeUpdatedEvent
ClickUpTaskCommentPostedEvent
ClickUpTaskCreatedEvent
ClickUpTaskDeletedEvent
ClickUpTaskMovedEvent
ClickUpTaskSemanticEvent
Bases: ClickUpSemanticEvent
Normalized ClickUp task event with shared location filters.
matches(target: ClickUpWebhookTargetEvent) -> bool
Return whether this event matches a typed task target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
ClickUpWebhookTargetEvent
|
The typed target event configuration. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this event matches the target. |
Source code in src/zenml/webhooks/providers/clickup.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
ClickUpTaskStatusUpdatedEvent
Bases: ClickUpTaskSemanticEvent
Normalized task-status-updated event.
matches(target: ClickUpWebhookTargetEvent) -> bool
Return whether this event matches a status-updated target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
ClickUpWebhookTargetEvent
|
The typed target event configuration. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this event matches the target. |
Source code in src/zenml/webhooks/providers/clickup.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | |
ClickUpTaskUpdatedEvent
ClickUpWebhookConfiguration
ClickUpWebhookEvent
ClickUpWebhookProvider
Bases: BaseWebhookProvider
Provider for authenticated and semantically matched ClickUp webhooks.
authenticate(body: bytes, headers: Mapping[str, str], secret: str) -> None
Authenticate a ClickUp delivery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The exact raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
secret
|
str
|
The webhook signing secret. |
required |
Source code in src/zenml/webhooks/providers/clickup.py
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
get_delivery_id(payload: dict[str, Any], headers: Mapping[str, str]) -> str | None
Build ClickUp's documented idempotency key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed ClickUp payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The documented history-based delivery ID, if available. Intake |
str | None
|
generates a unique ID for history-less events. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If webhook_id is missing. |
Source code in src/zenml/webhooks/providers/clickup.py
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | |
get_event_type(payload: dict[str, Any], headers: Mapping[str, str]) -> str
Extract the ClickUp event name from the JSON body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed ClickUp payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The ClickUp event name. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the event field is missing or empty. |
Source code in src/zenml/webhooks/providers/clickup.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | |
match_triggers(*, event: WebhookEvent, candidates: Sequence[WebhookTriggerResponse]) -> WebhookTriggerMatch[WebhookTriggerResponse]
Match ClickUp triggers and return the parsed semantic event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted ClickUp webhook event. |
required |
candidates
|
Sequence[WebhookTriggerResponse]
|
The candidate webhook triggers. |
required |
Returns:
| Type | Description |
|---|---|
WebhookTriggerMatch[WebhookTriggerResponse]
|
Matching triggers and their shared semantic event. |
Source code in src/zenml/webhooks/providers/clickup.py
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | |
parse_semantic_event(event: WebhookEvent) -> ClickUpSemanticEvent | None
Parse a trusted delivery into a normalized semantic event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted ClickUp webhook event. |
required |
Returns:
| Type | Description |
|---|---|
ClickUpSemanticEvent | None
|
The normalized semantic event, or |
Source code in src/zenml/webhooks/providers/clickup.py
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |
ListCreated
Bases: _ClickUpListTarget
Filters for a created ClickUp list.
ListDeleted
Bases: _ClickUpListTarget
Filters for a deleted ClickUp list.
ListUpdated
Bases: _ClickUpListTarget
Filters for an updated ClickUp list.
TaskAssigneeUpdated
Bases: _ClickUpTaskTarget
Filters for a ClickUp task assignee change.
TaskCommentPosted
Bases: _ClickUpTaskTarget
Filters for a comment posted on a ClickUp task.
TaskCreated
Bases: _ClickUpTaskTarget
Filters for a created ClickUp task.
TaskDeleted
Bases: _ClickUpTaskTarget
Filters for a deleted ClickUp task.
TaskMoved
Bases: _ClickUpTaskTarget
Filters for a ClickUp task moved to another list.
TaskStatusUpdated
Bases: _ClickUpTaskStatusTarget
Filters for a ClickUp task status change.
TaskUpdated
Bases: _ClickUpTaskTarget
Filters for an updated ClickUp task.
custom
Custom webhook provider.
CustomWebhookConfiguration
CustomWebhookProvider
Bases: BaseWebhookProvider
Provider for signed custom JSON webhook deliveries.
authenticate(body: bytes, headers: Mapping[str, str], secret: str) -> None
Authenticate a custom delivery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
secret
|
str
|
The signing secret. |
required |
Source code in src/zenml/webhooks/providers/custom.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
get_delivery_id(payload: dict[str, Any], headers: Mapping[str, str]) -> str | None
Extract the optional custom delivery ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The delivery ID, if present. |
Source code in src/zenml/webhooks/providers/custom.py
77 78 79 80 81 82 83 84 85 86 87 88 89 | |
get_event_type(payload: dict[str, Any], headers: Mapping[str, str]) -> str
Extract the custom event type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The event type. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the event header is missing. |
Source code in src/zenml/webhooks/providers/custom.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
match_triggers(*, event: WebhookEvent, candidates: Sequence[WebhookTriggerResponse]) -> WebhookTriggerMatch[WebhookTriggerResponse]
Match candidates with valid unfiltered custom configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted custom event. |
required |
candidates
|
Sequence[WebhookTriggerResponse]
|
The associated candidate triggers. |
required |
Returns:
| Type | Description |
|---|---|
WebhookTriggerMatch[WebhookTriggerResponse]
|
Matching candidates without semantic event metadata. |
Source code in src/zenml/webhooks/providers/custom.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
github
GitHub webhook provider and semantic target event catalog.
GitHubCommit
Bases: BaseModel
Commit metadata associated with a GitHub semantic event.
GitHubIssueOpenedEvent
Bases: GitHubSemanticEvent
Normalized newly opened issue event.
matches(target: GitHubWebhookTargetEvent) -> bool
Return whether this event matches an opened-issue target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
GitHubWebhookTargetEvent
|
The typed target event configuration. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this event matches the target. |
Source code in src/zenml/webhooks/providers/github.py
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
GitHubMergedPullRequestEvent
Bases: GitHubSemanticEvent
Normalized merged pull request event.
matches(target: GitHubWebhookTargetEvent) -> bool
Return whether this event matches a merged-pull-request target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
GitHubWebhookTargetEvent
|
The typed target event configuration. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this event matches the target. |
Source code in src/zenml/webhooks/providers/github.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
GitHubPushEvent
Bases: GitHubSemanticEvent
Normalized branch push event.
matches(target: GitHubWebhookTargetEvent) -> bool
Return whether this event matches a push target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
GitHubWebhookTargetEvent
|
The typed target event configuration. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this event matches the target. |
Source code in src/zenml/webhooks/providers/github.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
GitHubReleasePublishedEvent
Bases: GitHubSemanticEvent
Normalized published release event.
matches(target: GitHubWebhookTargetEvent) -> bool
Return whether this event matches a published-release target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
GitHubWebhookTargetEvent
|
The typed target event configuration. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this event matches the target. |
Source code in src/zenml/webhooks/providers/github.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
GitHubSemanticEvent
Bases: BaseModel
Provider event normalized for semantic trigger matching.
matches(target: GitHubWebhookTargetEvent) -> bool
abstractmethod
Return whether the semantic event matches its typed target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
GitHubWebhookTargetEvent
|
The typed target event configuration. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the semantic event matches the target. |
Source code in src/zenml/webhooks/providers/github.py
182 183 184 185 186 187 188 189 190 191 | |
GitHubWebhookConfiguration
GitHubWebhookEvent
GitHubWebhookEventType
GitHubWebhookProvider
Bases: BaseWebhookProvider
Provider for authenticated and semantically matched GitHub webhooks.
authenticate(body: bytes, headers: Mapping[str, str], secret: str) -> None
Authenticate a GitHub delivery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The exact raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
secret
|
str
|
The webhook signing secret. |
required |
Source code in src/zenml/webhooks/providers/github.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | |
get_delivery_id(payload: dict[str, Any], headers: Mapping[str, str]) -> str | None
Extract the optional GitHub delivery ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed GitHub payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The delivery ID, if present. |
Source code in src/zenml/webhooks/providers/github.py
478 479 480 481 482 483 484 485 486 487 488 489 490 | |
get_event_type(payload: dict[str, Any], headers: Mapping[str, str]) -> str
Extract the raw GitHub event family.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed GitHub payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The raw GitHub event family. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the GitHub event header is missing. |
Source code in src/zenml/webhooks/providers/github.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | |
match_triggers(*, event: WebhookEvent, candidates: Sequence[WebhookTriggerResponse]) -> WebhookTriggerMatch[WebhookTriggerResponse]
Match GitHub triggers and return the parsed semantic event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted GitHub webhook event. |
required |
candidates
|
Sequence[WebhookTriggerResponse]
|
The candidate webhook triggers. |
required |
Returns:
| Type | Description |
|---|---|
WebhookTriggerMatch[WebhookTriggerResponse]
|
Matching triggers and their shared semantic event. |
Source code in src/zenml/webhooks/providers/github.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
parse_semantic_event(event: WebhookEvent) -> GitHubSemanticEvent | None
Parse a trusted delivery into a normalized semantic event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted GitHub webhook event. |
required |
Returns:
| Type | Description |
|---|---|
GitHubSemanticEvent | None
|
The normalized semantic event, or |
Source code in src/zenml/webhooks/providers/github.py
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
pre_validate(headers: Mapping[str, str]) -> WebhookPreValidationResult
async
Reject malformed and ignore unsupported GitHub event families.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
headers
|
Mapping[str, str]
|
The untrusted request headers. |
required |
Returns:
| Type | Description |
|---|---|
WebhookPreValidationResult
|
Whether generic intake should process or ignore the delivery. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the GitHub event header is missing. |
Source code in src/zenml/webhooks/providers/github.py
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
GitHubWorkflowRunCompletedEvent
Bases: GitHubSemanticEvent
Normalized completed workflow run event.
matches(target: GitHubWebhookTargetEvent) -> bool
Return whether this event matches a workflow-run target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
GitHubWebhookTargetEvent
|
The typed target event configuration. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this event matches the target. |
Source code in src/zenml/webhooks/providers/github.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
IssueOpened
MergedPullRequest
PushEvent
ReleasePublished
WorkflowRunCompleted
registry
Registry for webhook provider implementations.
WebhookProviderRegistry()
Registry for webhook provider implementations.
Initialize the webhook provider registry.
Source code in src/zenml/webhooks/providers/registry.py
27 28 29 30 31 | |
get(webhook_type: str) -> BaseWebhookProvider
Instantiate the provider registered for a webhook type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
webhook_type
|
str
|
The webhook type identifier. |
required |
Returns:
| Type | Description |
|---|---|
BaseWebhookProvider
|
A new provider instance. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no provider is registered for the webhook type. |
Source code in src/zenml/webhooks/providers/registry.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
register(provider_class: type[BaseWebhookProvider], *, overwrite: bool = False) -> None
Register a webhook provider class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider_class
|
type[BaseWebhookProvider]
|
The provider class to register. |
required |
overwrite
|
bool
|
Whether to replace an existing registration. |
False
|
Source code in src/zenml/webhooks/providers/registry.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
register_builtin_providers() -> None
Register the built-in webhook providers once, on demand.
Source code in src/zenml/webhooks/providers/registry.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
get_webhook_provider(webhook_type: str) -> BaseWebhookProvider
Get the provider registered for a webhook type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
webhook_type
|
str
|
The webhook type identifier. |
required |
Returns:
| Type | Description |
|---|---|
BaseWebhookProvider
|
A new provider instance. |
Source code in src/zenml/webhooks/providers/registry.py
105 106 107 108 109 110 111 112 113 114 | |
slack
Slack Events API webhook provider.
AppMentionEventFilter
FileSharedEventFilter
MessageEventFilter
Bases: SlackEventFilter
Filters for a Slack message event.
validate_subtype_filters() -> MessageEventFilter
Reject competing broad and targeted subtype selection.
Returns:
| Type | Description |
|---|---|
MessageEventFilter
|
The validated message event filter. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If all subtypes and named subtypes are both selected. |
Source code in src/zenml/webhooks/providers/slack.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
MessageMetadataPostedEventFilter
Bases: _MessageMetadataEventFilter
Filters for Slack message metadata being posted.
MessageMetadataUpdatedEventFilter
Bases: _MessageMetadataEventFilter
Filters for Slack message metadata being updated.
ReactionAddedEventFilter
Bases: _ReactionEventFilter
Filters for a Slack reaction being added.
ReactionRemovedEventFilter
Bases: _ReactionEventFilter
Filters for a Slack reaction being removed.
SlackAppMentionEvent
Bases: SlackChannelEvent
Normalized Slack app mention.
matches(target: SlackWebhookEventFilter) -> bool
Return whether this mention matches an app-mention target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
SlackWebhookEventFilter
|
The typed Slack target event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this mention matches the target. |
Source code in src/zenml/webhooks/providers/slack.py
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
SlackChannelEvent
Bases: SlackUserEvent
Base event with a required Slack channel identifier.
matches(target: SlackWebhookEventFilter) -> bool
Match the required channel identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
SlackWebhookEventFilter
|
The typed Slack target event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the event's team, user, and channel match the target. |
Source code in src/zenml/webhooks/providers/slack.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
SlackEventFilter
SlackFileSharedEvent
Bases: SlackChannelEvent
Normalized Slack file-shared event.
matches(target: SlackWebhookEventFilter) -> bool
Return whether this file share matches a file-share target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
SlackWebhookEventFilter
|
The typed Slack target event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this file share matches the target. |
Source code in src/zenml/webhooks/providers/slack.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | |
SlackMessageEvent
Bases: SlackSemanticEvent
Normalized Slack message event.
matches(target: SlackWebhookEventFilter) -> bool
Return whether this message matches a message target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
SlackWebhookEventFilter
|
The typed Slack target event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this message matches the target. |
Source code in src/zenml/webhooks/providers/slack.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | |
SlackMessageMetadata
Bases: BaseModel
Structured metadata attached to a Slack message.
SlackMessageMetadataEvent
Bases: SlackChannelEvent
Shared normalized fields for a Slack message-metadata event.
matches(target: SlackWebhookEventFilter) -> bool
Return whether this metadata event matches its typed target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
SlackWebhookEventFilter
|
The typed Slack target event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this metadata event matches the target. |
Source code in src/zenml/webhooks/providers/slack.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
SlackMessageMetadataPostedEvent
SlackMessageMetadataUpdatedEvent
SlackReactionAddedEvent
SlackReactionEvent
Bases: SlackUserEvent
Shared normalized fields for a Slack reaction event.
matches(target: SlackWebhookEventFilter) -> bool
Return whether this reaction matches its reaction target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
SlackWebhookEventFilter
|
The typed Slack target event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether this reaction matches the target. |
Source code in src/zenml/webhooks/providers/slack.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | |
SlackReactionItem
Bases: BaseModel
Normalized item referenced by a Slack reaction event.
SlackReactionRemovedEvent
SlackSemanticEvent
Bases: BaseModel
Provider event normalized for semantic trigger matching.
matches(target: SlackWebhookEventFilter) -> bool
Match identifiers shared by all Slack semantic events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
SlackWebhookEventFilter
|
The typed Slack target event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the event's team matches the target. |
Source code in src/zenml/webhooks/providers/slack.py
223 224 225 226 227 228 229 230 231 232 233 234 | |
SlackUserEvent
Bases: SlackSemanticEvent
Base event with a required Slack user identifier.
matches(target: SlackWebhookEventFilter) -> bool
Match the required user identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
SlackWebhookEventFilter
|
The typed Slack target event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the event's team and user match the target. |
Source code in src/zenml/webhooks/providers/slack.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
SlackWebhookConfiguration
SlackWebhookEventType
SlackWebhookProvider
Bases: BaseWebhookProvider
Provider for signed Slack Events API deliveries.
authenticate(body: bytes, headers: Mapping[str, str], secret: str) -> None
Authenticate a Slack delivery using its exact raw body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
secret
|
str
|
The Slack app signing secret. |
required |
Raises:
| Type | Description |
|---|---|
WebhookAuthenticationError
|
If the request cannot be authenticated. |
Source code in src/zenml/webhooks/providers/slack.py
550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |
get_event_type(payload: dict[str, Any], headers: Mapping[str, str]) -> str
Reject direct event parsing in favor of delivery parsing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict[str, Any]
|
The parsed Slack payload. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
str
|
This method never returns successfully. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always, because Slack has control deliveries. |
Source code in src/zenml/webhooks/providers/slack.py
731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | |
match_triggers(*, event: WebhookEvent, candidates: Sequence[WebhookTriggerResponse]) -> WebhookTriggerMatch[WebhookTriggerResponse]
Match candidates and return the parsed semantic event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted webhook event. |
required |
candidates
|
Sequence[WebhookTriggerResponse]
|
Triggers selected by generic orchestration. |
required |
Returns:
| Type | Description |
|---|---|
WebhookTriggerMatch[WebhookTriggerResponse]
|
The matching triggers and any parsed semantic event. |
Source code in src/zenml/webhooks/providers/slack.py
771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | |
parse_delivery(body: bytes, headers: Mapping[str, str]) -> ParsedWebhookDelivery
Parse a Slack event or control delivery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body
|
bytes
|
The raw request body. |
required |
headers
|
Mapping[str, str]
|
The request headers. |
required |
Returns:
| Type | Description |
|---|---|
ParsedWebhookDelivery
|
The optional event and Slack-compatible response. |
Raises:
| Type | Description |
|---|---|
WebhookPayloadError
|
If the Slack envelope is malformed. |
Source code in src/zenml/webhooks/providers/slack.py
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
parse_semantic_event(event: WebhookEvent) -> SlackSemanticEvent | None
Normalize a trusted Slack event for trigger matching.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
WebhookEvent
|
The trusted Slack webhook event. |
required |
Returns:
| Type | Description |
|---|---|
SlackSemanticEvent | None
|
The normalized supported event, or |
Source code in src/zenml/webhooks/providers/slack.py
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | |
types
Identifiers for webhook providers bundled with ZenML.
BuiltinWebhookType