Portal Community

Event Reference

Event ClassWhen PublishedKey Payload Fields
WorkflowStartedExecution begins (first node queued)ExecutionId, ProcessId, TenantId, TriggeredBy, StartedAt
WorkflowCompletedAll nodes finished successfullyExecutionId, ProcessId, TenantId, DurationMs, CompletedAt
WorkflowFailedA node threw an unrecoverable errorExecutionId, ProcessId, TenantId, FailedNodeId, Error, FailedAt
WorkflowPausedA HIL node suspended the executionExecutionId, ProcessId, TenantId, SuspendedNodeId, SuspendedAt
WorkflowResumedA HIL resume call restarted executionExecutionId, ProcessId, TenantId, ResumedAt, ResumedBy

WorkflowStarted

public class WorkflowStarted : WorkflowEvent
{
    public string TriggeredBy { get; init; }  // userId or "system"
    public DateTimeOffset StartedAt { get; init; }
    public Dictionary<string, object>? TriggerPayload { get; init; }
}

WorkflowCompleted

public class WorkflowCompleted : WorkflowEvent
{
    public long DurationMs   { get; init; }
    public DateTimeOffset CompletedAt { get; init; }
    public WorkflowStatus Status { get; init; }  // Success
}

WorkflowFailed

public class WorkflowFailed : WorkflowEvent
{
    public string FailedNodeId   { get; init; }
    public string FailedNodeType { get; init; }
    public string ErrorMessage   { get; init; }
    public string? ErrorType     { get; init; }
    public DateTimeOffset FailedAt { get; init; }
}

WorkflowPaused

public class WorkflowPaused : WorkflowEvent
{
    public string SuspendedNodeId   { get; init; }
    public string CorrelationToken  { get; init; }
    public string ActorId           { get; init; }
    public DateTimeOffset SuspendedAt { get; init; }
    public DateTimeOffset? ExpiresAt  { get; init; }
}

WorkflowResumed

public class WorkflowResumed : WorkflowEvent
{
    public string ResumedBy         { get; init; }  // userId who responded
    public string CorrelationToken  { get; init; }
    public DateTimeOffset ResumedAt { get; init; }
}

Subscribing to a Built-In Event (Example)

// Handler: send a webhook when a workflow completes or fails
public class WorkflowWebhookHandler :
    IWorkflowEventHandler<WorkflowCompleted>,
    IWorkflowEventHandler<WorkflowFailed>
{
    private readonly IWebhookService _webhooks;

    public WorkflowWebhookHandler(IWebhookService webhooks) => _webhooks = webhooks;

    public async Task HandleAsync(WorkflowCompleted @event, CancellationToken ct)
    {
        await _webhooks.DeliverAsync(@event.ProcessId, "completed", new
        {
            executionId = @event.ExecutionId,
            durationMs  = @event.DurationMs,
            status      = "success"
        }, ct);
    }

    public async Task HandleAsync(WorkflowFailed @event, CancellationToken ct)
    {
        await _webhooks.DeliverAsync(@event.ProcessId, "failed", new
        {
            executionId  = @event.ExecutionId,
            failedNode   = @event.FailedNodeId,
            errorMessage = @event.ErrorMessage
        }, ct);
    }
}

// Registration (both event types, same handler class)
services.AddTransient<IWorkflowEventHandler<WorkflowCompleted>, WorkflowWebhookHandler>();
services.AddTransient<IWorkflowEventHandler<WorkflowFailed>,    WorkflowWebhookHandler>();