RAP Logo

inject

Inject messages into a flow manually or automatically to start workflows

inject Block

The inject block injects a message into a flow either manually or at regular intervals. The message payload can be a variety of types, including strings, JavaScript objects or the current time.

Overview

The inject block can initiate a flow with a specific payload value. The default payload is a timestamp of the current time in millisecs since January 1st, 1970. The block also supports injecting strings, numbers, booleans, JavaScript objects, or flow/global context values.

By default, the block is triggered manually by clicking on its button within the editor. It can also be configured to inject once each time the flows are started.

Outputs

PropertyTypeDescription
payloadvariousThe configured payload of the message
topicstringAn optional property that can be configured in the block

Configuration Options

Message Properties

  • Topic: Optional topic for the injected message
  • Payload: The data to inject (can be various data types)
  • Payload Type: Choose from:
    • Timestamp (default)
    • String
    • Number
    • Boolean
    • JSON Object
    • Buffer
    • Flow/Global Context
    • JSONata Expression

Injection Options

  • Manual: Click the button on the block to inject manually
  • Once at Start: Inject once when the flow is deployed

Common Use Cases

Manual Testing

Start flows manually for testing and debugging:

{
  "payload": "test data",
  "topic": "manual_test"
}

Flow Initialization

Trigger flows when they start up:

{
  "payload": {
    "initialized": true,
    "timestamp": 1640995200000
  }
}

Data Injection

Inject structured data into workflows:

{
  "payload": {
    "document_url": "https://example.com/doc.pdf",
    "process_type": "ocr_extraction"
  },
  "topic": "document_processing"
}

Tips

  • Use the inject block to test individual parts of your flow during development
  • The timestamp payload is useful for triggering time-based processing
  • Set meaningful topics to help identify message sources in complex flows
  • Use JSON objects to inject structured configuration data
  • The block's button in the editor makes manual testing easy

Notes

  • The inject block is essential for starting most workflows
  • Multiple inject blocks can be used in a single flow for different entry points
  • Context values can be injected to share data between flows
  • The block appears as a button that can be clicked to manually trigger injection