brettapps / knowledge /webhooks.md
Brettapps's picture
Upload folder using huggingface_hub
24ba1f5 verified
# KB: Webhooks & Event-Driven Architecture
Webhooks enable the EbookBuilder and API Wizard to respond to real-time events from external services (e.g., GitHub, Stripe, Hugging Face).
## Implementation
- **Endpoints**: Secure HTTPS endpoints that listen for `POST` requests.
- **Payload Verification**: Using HMAC signatures (e.g., `X-Hub-Signature`) to ensure requests originate from a trusted source.
- **Asynchronous Processing**: Webhooks should immediately return a `202 Accepted` and queue the task for an agent to handle.
## Common Events
- `repo_update`: Triggers a re-download of a knowledge base module.
- `generation_complete`: Notifies the user when an LLM chapter draft is ready.
- `subscription_change`: Manages access tiers for the EbookBuilder interface.