Skip to main content

Inject

The Inject activity is used to inject a payload into a flow to start it.

Input

  • Payload - Data to be injected into the flow.

Output

  • Payload - Data that is injected into the flow.

Options

  • Repeat Interval (sec) - The interval (in seconds) at which to repeat the payload injection.
  • Once - If selected, the payload injection will happen just once.
  • Once Delay (sec) - If Once is selected, this property specifies the delay (in seconds) before the payload is injected.

How It Works

The Inject node triggers flow execution by injecting payloads at specified intervals:

  1. During flow initialization:
    • Creates a background repeater goroutine (unless in run-from-node-only mode)
    • Waits for the robot to be in running state
  2. Repeater behavior depends on configuration:
    • Once mode: Waits for Once Delay seconds, injects payload once, then stops
    • Repeat mode: Injects payload every Repeat Interval seconds continuously
  3. Each injection:
    • Creates a new message with unique ID
    • Emits the payload as input to trigger flow execution
  4. When flow is deployed, Inject nodes do not auto-start (manual trigger only)
  5. On close, the repeater goroutine is terminated

Requirements

  • Payload must be provided (cannot be empty)
  • Either Once or Repeat mode must be configured
  • Minimum delay/interval is 0.001 seconds (adjusted automatically if set to 0 or negative)

Error Handling

Error CodeDescriptionSolution
Core.Triggers.Inject.ErrOnCreateFailed to parse node configurationVerify node configuration is valid JSON
Core.Triggers.Inject.ErrOnMessageMessage parsing failedCheck input message format is valid
Core.Triggers.Inject.ErrInPayload"Input payload is empty"Provide a valid payload value

Usage Examples

Example 1: Trigger Daily Report Generation

Inject payload once per day:

[Inject]
Payload: {"reportType": "daily", "date": "${currentDate}"}
Repeat Interval: 86400 (24 hours)
Once: false

[Generate Daily Report]

[Send Email with Report]

Example 2: One-Time Initialization

Run initialization after a delay:

[Inject]
Payload: {"action": "initialize", "config": {...}}
Once: true
Once Delay: 5

[Load Configuration]

[Initialize System]

[Start Main Process]

Example 3: Periodic Health Check

Check system health every 5 minutes:

[Inject]
Payload: {"action": "healthCheck"}
Repeat Interval: 300
Once: false

[Check Database Connection]

[Check API Availability]

[Log Health Status]

Usage Notes

  • Inject nodes automatically start when the flow starts (except in deployment or run-from-node-only modes)
  • Minimum interval/delay is 0.001 seconds (values 0 or less are adjusted)
  • Once mode: Injects payload after Once Delay seconds, then stops
  • Repeat mode: Continuously injects payload every Repeat Interval seconds
  • Each injection creates a new flow execution instance
  • Payload can be static values or dynamic expressions
  • The repeater waits for the robot to reach running state before first injection
  • In deployment mode, Inject nodes don't auto-start (manual trigger only)
  • Closing the flow terminates all active Inject repeaters

Tips

  • Use Once mode for startup initialization tasks
  • Use Repeat mode for periodic tasks (monitoring, data sync, scheduled operations)
  • Set appropriate intervals based on task frequency and system load
  • Avoid very short intervals (< 1 second) unless necessary - they can overload the system
  • Use dynamic payload expressions to inject current timestamps or changing data
  • Combine with decision nodes to implement conditional processing
  • For complex scheduling, consider using Timer node instead
  • Test Once Delay carefully - too short may not allow proper initialization
  • Use Inject for simple periodic triggers; use Timer for cron-like scheduling
  • Monitor system resources when using short repeat intervals
  • Consider using Queue-based workflows instead of high-frequency Inject for production workloads
  • Timer - For cron-based scheduling
  • Catch - For handling Inject errors
  • Should Stop - For graceful shutdown of repeated injections
  • Stop - For terminating flow execution