Skip to main content
Build reactive automation pipelines that respond to discoveries, chain workflows together, and integrate with external systems.

Overview

Example on Trigger Event

Example on Trigger Event

Event-driven triggers enable workflows to execute automatically in response to events:
  • React to discoveries: Scan new subdomains as they’re found
  • Chain workflows: Connect reconnaissance → probing → scanning
  • External integration: Receive webhooks from GitHub, CI/CD, or custom tools
  • Real-time automation: Process findings as they occur

Event Architecture

Event Structure

Events carry structured data through the system:

Event Flow

Backpressure Handling

The event system protects against overload: Monitor queue health via metrics (see Monitoring Events).

Emitting Events

From Workflow Functions

Use the generate_event function to emit events from workflows:

generate_event(workspace, topic, source, data_type, data)

Emit a single structured event.
Parameters:
  • workspace - Workspace identifier for the event
  • topic - Event topic/category (e.g., “assets.new”)
  • source - Event source (e.g., “nuclei”, “httpx”)
  • data_type - Type of data (e.g., “subdomain”, “url”, “finding”)
  • data - Event payload (string or object)
Returns: boolean - true if event was sent successfully

generate_event_from_file(workspace, topic, source, data_type, path)

Emit an event for each non-empty line in a file.
Parameters:
  • workspace - Workspace identifier for the events
  • topic - Event topic/category
  • source - Event source
  • data_type - Type of data
  • path - File path containing data (one item per line)
Returns: integer - count of events successfully generated

Webhook Functions

Send events to external webhook endpoints configured in settings:

notify_webhook(message)

Send a plain text message to all configured webhooks.

send_webhook_event(eventType, data)

Send a structured event to all configured webhooks.

From External Systems (Webhooks)

Receive webhooks via the API to trigger workflows:

Event Triggers

Trigger Configuration

Configure event triggers in workflow YAML:

EventConfig Fields

TriggerInput Options

Trigger input supports two syntaxes: a legacy syntax and a new exports-style syntax. Map multiple event fields to workflow variables using a concise syntax:
Expression Types:
  • event_data.<field> - Access parsed event data fields (e.g., event_data.url, event_data.severity)
  • event.<field> - Access event metadata (event.topic, event.source, event.name, event.id, event.data_type, event.workspace, event.run_uuid, event.workflow_name)
  • function(...) - Transform values using utility functions (e.g., trim(event_data.desc), lower(event_data.name))

Legacy Syntax

The original input configuration (still supported for backward compatibility):

Topic Glob Patterns

Event topics support glob patterns for flexible matching:

JavaScript Filters

Filters are JavaScript expressions evaluated against each event. All filters must return true for the event to trigger the workflow.

Available Event Fields

Filter Examples

Common Filter Patterns

Filter Functions

For more advanced filtering, use filter_functions which provides access to utility functions like contains(), starts_with(), ends_with(), file_exists(), and more:

Available Filter Functions

Combining Filters and Filter Functions

You can use both filters (basic JS) and filter_functions (with utilities) together. All expressions from both must pass:

Event Envelope Template Variables

Event-triggered workflows have access to special template variables containing the full event data: Example usage:

Deduplication

Prevent duplicate workflow triggers using time-windowed deduplication:
Dedupe key supports template variables:
  • {{event.source}}-{{event.data.url}} - Composite key
  • {{event.data.hash}} - Simple field

Event Topics Reference

Built-in Topics

Custom Topics

Define your own topics for domain-specific events:

Building Event Pipelines

Chaining Workflows

Create pipelines where each workflow triggers the next:

Stage 1: Subdomain Enumeration

Stage 2: HTTP Probing (Triggered by Stage 1)

Stage 3: Vulnerability Scanning (Triggered by Stage 2)

Error Handling Pattern

Handle failures gracefully with error events:

Real-World Examples

Asset Discovery Pipeline

Complete subdomain discovery to live host probing:

Vulnerability Notification

Automatically notify on critical findings:

External Integration: GitHub Webhooks

Trigger scans on repository pushes:

Monitoring Events

Event Logs API

Query event history via the REST API:

CLI Event Logs

Query event history using the database CLI:

Queue Metrics

The scheduler tracks event processing metrics: Access via health endpoint:

Event Receiver Status

Check the status of event-triggered workflows:

Bulk Event Processing

Process multiple targets discovered via events using the func eval bulk processing capabilities.

Processing Targets from File

Using Function Files

Store reusable processing logic in files:

Function Call Syntax

Multiple ways to invoke functions:

Integration with Event Pipeline

Combine event log queries with bulk function evaluation:

Testing Event Functions

Test event generation before deploying workflows:

Best Practices

  1. Use specific topics - Prefer assets.subdomain over generic assets.new for precise filtering
  2. Filter early - Apply filters to reduce processing overhead and prevent unnecessary workflow triggers
  3. Handle backpressure gracefully - Design workflows to tolerate dropped events during high load
  4. Log event errors - Use on_error handlers to track and emit failure events for debugging
  5. Test triggers disabled first - Set enabled: false initially, validate filters, then enable
  6. Use idempotent handlers - Workflows may receive duplicate events; design steps to handle this
  7. Batch file emissions - Use generate_event_from_file for bulk discoveries instead of individual events
  8. Use deduplication - Configure dedupe_key and dedupe_window to prevent duplicate processing
  9. Include workspace - Always pass the workspace parameter to maintain proper event isolation

Troubleshooting

Events Not Triggering

  1. Check topic match: Event topic must exactly match trigger configuration
  2. Verify trigger is enabled: enabled: true in workflow YAML
  3. Test filter expressions: Simplify filters to isolate issues
  4. Check scheduler is running: Events only process when server is active
  5. Check event receiver status:

Events Dropped

  1. Check queue metrics: High events_dropped indicates overload
  2. Reduce event volume: Batch discoveries, filter at source
  3. Increase queue size: Configure via scheduler settings if needed
  4. Scale with workers: Distribute processing across workers

Filter Not Matching

  1. Verify event data structure: Check actual event payload
  2. Test JS expression: Filters use JavaScript syntax
  3. Check data types: String vs number comparisons

Testing Event Functions

Use the CLI to test event functions interactively: