Expand description
Webhook event notification system.
This module provides real-time notifications for memory events through webhooks. It supports configurable event subscriptions, domain scoping, and multiple authentication methods (Bearer token and HMAC signature).
§Architecture
The webhook system follows a clean architecture with clear separation of concerns:
- Config (
config.rs): Configuration types and YAML parsing - Payload (
payload.rs): JSON payload building and HMAC signing - Delivery (
delivery.rs): HTTP delivery trait and implementation - Audit (
audit.rs): GDPR-compliant delivery logging - Dispatcher (
dispatcher.rs): Event bus subscription and routing
§Example Configuration
Webhooks are configured in ~/.config/subcog/webhooks.yaml:
webhooks:
- name: slack-notifications
url: https://hooks.slack.com/services/YOUR/WEBHOOK/URL
auth:
type: bearer
token: xoxb-your-token
events:
- captured
- deleted
scopes:
- project
- user
retry:
max_retries: 3
base_delay_ms: 1000
timeout_secs: 30§GDPR Compliance
All webhook deliveries are logged to a domain-scoped SQLite database.
The audit log supports:
- Export of all logs for a domain (
export_logs) - Deletion of all logs for a domain (
delete_logs)
§Event Types
The following events can trigger webhooks:
captured- A new memory was capturedupdated- An existing memory was updateddeleted- A memory was deleted (tombstoned)consolidated- Memories were consolidated into a summaryarchived- A memory was archivedretrieved- A memory was retrieved (search)synced- Memories were synced with remote
Use * to subscribe to all events.
Modules§
- audit 🔒
- GDPR-compliant webhook delivery audit logging.
- config 🔒
- Webhook configuration types.
- delivery 🔒
- Webhook delivery backend trait and HTTP implementation.
- dispatcher 🔒
- Event dispatcher for routing memory events to webhooks.
- payload 🔒
- Webhook payload types and HMAC signing.
Structs§
- Delivery
Record - A webhook delivery audit record.
- Delivery
Result - Result of a webhook delivery attempt.
- Event
Filter - Event filter configuration.
- Http
Delivery Backend - HTTP webhook delivery backend using reqwest.
- Retry
Config - Retry configuration for webhook delivery.
- Webhook
Audit Logger SQLite-backed webhook audit logger.- Webhook
Config - Root configuration for webhooks.
- Webhook
Dispatcher - Event dispatcher that routes memory events to matching webhooks.
- Webhook
Endpoint - Configuration for a single webhook endpoint.
- Webhook
Payload - Webhook payload sent to webhook endpoints.
- Webhook
Service - Webhook service that manages configuration, delivery, and audit logging.
Enums§
- Delivery
Status - Delivery status for audit logging.
- Payload
Format - Payload format for webhook delivery.
- Webhook
Auth - Authentication configuration for a webhook.
Traits§
- Webhook
Audit Backend - Trait for webhook audit storage backends.
- Webhook
Delivery - Trait for webhook delivery backends.