Skip to main content
The Webhook subsystem provides a secure, high-performance mechanism for ingesting external events into the Palyra ecosystem. It features a robust registry for managing integrations, cryptographic signature verification, replay protection, and a dedicated CLI for administrative testing and lifecycle management.

Webhook Registry and Persistence

The WebhookRegistry manages the persistence of webhook configurations in a TOML-backed store. It ensures that all webhook metadata—including allowed events, sources, and security requirements—is stored securely with owner-only file permissions.

Registry Configuration

The registry is stored in a file named webhooks.toml within the daemon’s state directory crates/palyra-daemon/src/webhooks.rs#16-16. It supports up to 1,024 unique integrations crates/palyra-daemon/src/webhooks.rs#17-17.
FieldConstraintDescription
integration_idMax 64 bytesUnique identifier for the integration.
providerMax 64 bytesThe source system (e.g., GitHub, Stripe).
max_payload_bytesMax 1 MiBHard limit on the size of incoming JSON.
signature_requiredBooleanWhether to enforce HMAC/Signature headers.
Sources: crates/palyra-daemon/src/webhooks.rs#15-24, crates/palyra-daemon/src/webhooks.rs#52-72

Webhook Readiness State

An integration is considered “Ready” only if it is enabled, has a valid secret reference in the Vault, and has no configuration issues crates/palyra-daemon/src/webhooks.rs#81-86.

Ingestion Flow and Security

The daemon handles webhook ingestion through a specialized pipeline that prioritizes security and replay protection.

Data Flow Diagram: Webhook Ingestion

The following diagram bridges the natural language flow to the internal code entities. Sources: crates/palyra-daemon/src/webhooks.rs#107-111, crates/palyra-daemon/src/webhooks.rs#218-223, crates/palyra-common/src/process_runner_input.rs#26-31

Signature Verification and Replay Protection

Webhooks are verified using the palyra_common::parse_webhook_payload utility crates/palyra-daemon/src/webhooks.rs#9-9.

CLI Management

The palyra CLI provides a comprehensive suite of commands for managing webhooks under the webhooks subcommand crates/palyra-cli/src/commands/webhooks.rs#12-12.

Key Commands

Testing Interface

The Test command is particularly useful for debugging signature issues. It encodes the local payload as Base64 and sends it to the daemon’s test endpoint crates/palyra-cli/src/commands/webhooks.rs#106-110. Sources: crates/palyra-cli/src/commands/webhooks.rs#100-110, crates/palyra-daemon/src/webhooks.rs#46-49

Error Handling

The system uses a specialized WebhookRegistryError enum to handle various failure modes crates/palyra-daemon/src/webhooks.rs#142-175.
Error VariantCause
LockPoisonedInternal mutex failure crates/palyra-daemon/src/webhooks.rs#144-144.
IntegrationNotFoundRequested integration_id does not exist crates/palyra-daemon/src/webhooks.rs#168-168.
RegistryLimitExceededAttempting to exceed 1,024 integrations crates/palyra-daemon/src/webhooks.rs#172-172.
InvalidFieldValidation failure for identifiers or providers crates/palyra-daemon/src/webhooks.rs#169-170.
Sources: crates/palyra-daemon/src/webhooks.rs#141-175