Skip to main content

Module webhooks

Module webhooks 

Source
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 captured
  • updated - An existing memory was updated
  • deleted - A memory was deleted (tombstoned)
  • consolidated - Memories were consolidated into a summary
  • archived - A memory was archived
  • retrieved - 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§

DeliveryRecord
A webhook delivery audit record.
DeliveryResult
Result of a webhook delivery attempt.
EventFilter
Event filter configuration.
HttpDeliveryBackend
HTTP webhook delivery backend using reqwest.
RetryConfig
Retry configuration for webhook delivery.
WebhookAuditLogger
SQLite-backed webhook audit logger.
WebhookConfig
Root configuration for webhooks.
WebhookDispatcher
Event dispatcher that routes memory events to matching webhooks.
WebhookEndpoint
Configuration for a single webhook endpoint.
WebhookPayload
Webhook payload sent to webhook endpoints.
WebhookService
Webhook service that manages configuration, delivery, and audit logging.

Enums§

DeliveryStatus
Delivery status for audit logging.
PayloadFormat
Payload format for webhook delivery.
WebhookAuth
Authentication configuration for a webhook.

Traits§

WebhookAuditBackend
Trait for webhook audit storage backends.
WebhookDelivery
Trait for webhook delivery backends.