Skip to main content

Module webhook

Module webhook 

Source
Expand description

Outbound webhook notifier for workflow lifecycle events.

This module provides WebhookNotifier which builds JSON payloads and HMAC-SHA256 signatures for outbound HTTP POST webhooks fired when workflow events occur (started, completed, failed, step completed/failed).

This is distinct from crate::triggers::WebhookTrigger which handles inbound webhooks that start a workflow. The notifier sends outbound notifications to external systems.

§Usage

use oximedia_workflow::webhook::{WebhookConfig, WebhookEvent, WebhookNotifier, WorkflowContext};

let config = WebhookConfig {
    url: "https://example.com/hooks/workflow".to_string(),
    secret: Some("my-secret".to_string()),
    events: vec![WebhookEvent::WorkflowCompleted, WebhookEvent::WorkflowFailed],
    max_retries: 3,
    timeout_ms: 5_000,
};

let notifier = WebhookNotifier::new(config);

let ctx = WorkflowContext {
    workflow_id: "wf-001".to_string(),
    workflow_name: "transcode-pipeline".to_string(),
    state: "completed".to_string(),
    variables: std::collections::HashMap::new(),
};

let payload = notifier.build_payload(&WebhookEvent::WorkflowCompleted, &ctx);
let signature = notifier.compute_signature(&payload);

Structs§

WebhookConfig
Configuration for an outbound webhook endpoint.
WebhookNotifier
Builds outbound webhook payloads and signatures.
WorkflowContext
Contextual information about a workflow included in every notification payload.

Enums§

WebhookEvent
Events that can trigger an outbound webhook notification.