Project Stage | CI | Release | Snapshot | Discord |
---|---|---|---|---|
Microlibrary for reliable and persistent webhook delivery.
There are two ways to start a webhook server: as part of the managed construction of its live layer
WebhookServer.live
, or manually by calling WebhookServer.start
. See examples for a list of code
examples. The managed approach is recommended as it guarantees the server shuts down gracefully. Make sure to
call shutdown
on a server created manually. Either way, users will have to implement the following dependencies that are part of WebhookServer
's environment:
WebhookRepo
- to get webhooks and update webhook status;WebhookEventRepo
- to subscribe to events and update event status;WebhookHttpClient
- to deliver events via HTTP POST (WebhookSttpClient is provided and ready to use);WebhookServerConfig
- to specify settings for error hub capacity, retrying, and batching; andSerializePayload
- for specifying custom serialization of single and batched event payloads of some content type.
- Basic example - most basic usage with the default configuration.
- Basic example with batching - same as the basic example but with batching enabled.
- Basic example with retrying - shows how the server retries when an endpoint fails sometimes.
- Custom config example - a custom configuration example that also showcases batched retries.
- Event recovery example - shows how the server continues retries after being restarted.
- Manual server example - shows how to create, start, and shut down a server programmatically.
- Shutdown on first error - shows how to shut down the server on the first error encountered.
Documentation for contributors
See the Code of Conduct