Building Your First Workflow
This step-by-step guide walks you through creating a complete workflow in RocketWave Pulse.
Prerequisites
Before you begin, ensure you have:
- Access to the Admin Console
- An organization selected
- An environment created (e.g., "Development")
- At least one AI model configured (for prompt entities)
Goal
We'll build a simple workflow that:
- Receives a message with type "greeting"
- Generates a personalized response using AI
- Logs the response and completes successfully
Step 1: Create the Event Entity
The Event entity is the entry point that filters incoming messages.
Navigate to Entities
- Open the Admin Console
- Select your organization
- Select your environment
- Go to Workflows → Canvas
Create the Event
- Click the + Event button in the entity palette
- Fill in the form:
- Name:
Greeting Event - Description:
Triggers when message type is greeting - Condition Mode:
Single Path
- Name:
Configure the Condition
-
Click Add Condition
-
Set:
- Field:
message.type - Operator:
equals - Value:
greeting
- Field:
-
Click Save
The entity is now created and appears in your entity library.
Step 2: Create the Prompt Entity
The Prompt entity calls an AI model to generate a response.
Create the Prompt
- Click the + Prompt button
- Fill in:
- Name:
Generate Greeting Response - Description:
Creates a friendly response to the greeting - Model: Select your configured AI model
- Name:
Write the Prompt Template
In the prompt text area, enter:
- Click Save
Step 3: Create the Action Entity
The Action entity executes JavaScript code - we'll use it to log the AI response.
Create the Action
- Click the + Action button
- Fill in:
- Name:
Log Response - Description:
Logs the AI-generated response
- Name:
Write the Script
In the script editor, enter:
// Get the AI response from the previous prompt
const response = await latestPromptResponse();
// Log it for debugging
print('Generated response:', response);
// Optionally pass data to the next node
output = {
response: response,
processedAt: new Date().toISOString()
};
- Click Save
Step 4: Build the Workflow
Now we connect the entities on the canvas.
Create a New Workflow
- Click New Workflow in the top bar
- Enter:
- Name:
Greeting Responder - Description:
Responds to greeting messages
- Name:
Add Nodes to Canvas
- Drag Greeting Event from the entity palette to the canvas
- Drag Generate Greeting Response to the right of the event
- Drag Log Response to the right of the prompt
Connect the Nodes
- Hover over the Greeting Event node - you'll see an output port
- Click and drag from the output port to the input port of Generate Greeting Response
- Repeat to connect Generate Greeting Response → Log Response
Your canvas should look like:
⭕ Greeting Event → 🧠 Generate Greeting Response → ⭐ Log Response
Save the Workflow
- Click Save in the top bar
- Toggle Active to enable the workflow
Step 5: Test the Workflow
Send a Test Message
You can test by sending a message to your Kinesis stream or using the Chat API:
{
"type": "greeting",
"content": "Hello there!",
"userName": "David",
"organizationId": "your-org-id",
"environmentId": "your-env-id"
}
Check the Logs
- Go to Processed Messages in the Admin Console
- Look for your message in the Success tab
- Check the logs for the
print()output
Understanding Workflow Outcomes
When a workflow completes, its outcome is determined automatically:
| Outcome | When it occurs |
|---|---|
| Success | Workflow completes without errors |
| Error/Fail | A script throws an error or times out |
| Ignore | Event condition doesn't match the message |
You don't need a special "result" node - just ensure your Action scripts handle errors gracefully.
Understanding the Workflow Data
When you save the workflow, it creates this workflowData structure:
{
"nodes": {
"n1": {
"entityId": "greeting-event-uuid",
"name": "Greeting Event",
"entityType": "event",
"tfCondition": "Single Path",
"presentation": {
"type": "circle",
"position": { "x": 100, "y": 200 }
}
},
"n2": {
"entityId": "prompt-uuid",
"name": "Generate Greeting Response",
"entityType": "prompt",
"presentation": {
"type": "brain",
"position": { "x": 350, "y": 200 }
}
},
"n3": {
"entityId": "action-uuid",
"name": "Log Response",
"entityType": "action",
"presentation": {
"type": "star",
"position": { "x": 600, "y": 200 }
}
}
},
"connectors": {
"c1": {
"source": "n1",
"target": "n2",
"sourcePort": "out",
"targetPort": "in"
},
"c2": {
"source": "n2",
"target": "n3",
"sourcePort": "out",
"targetPort": "in"
}
},
"workflow": {
"ref": "n1",
"children": [
{
"ref": "n2",
"children": [
{
"ref": "n3",
"children": []
}
]
}
]
}
}
Adding Branching
To add True/False branching to your event:
1. Edit the Event
- Click on the Greeting Event node
- Change Condition Mode to
True/False - Save the entity
2. Add Logic Branches
When an event is set to True/False:
- Two logic branch nodes automatically appear:
trueandfalse - Connect subsequent nodes to these branches
3. Handle Both Paths
- true branch: Connect to nodes that handle matching messages
- false branch: Can be left empty (message will be ignored) or connect to nodes for non-matching logic
Using Iterable Mode for Array Processing
Iterable mode allows you to process each item in an array separately. This is useful for batch operations.
Configure Iterable Event
- Create or edit an Event
- Set Logic Path Mode to
Iterable - Set Logic Field to the array path (e.g.,
message.recipients)
Example Configuration:
{
"name": "Process Each Order Item",
"tfCondition": "Iterable",
"logicField": "message.order.items"
}
Access Current Item in Scripts
In downstream Prompts and Actions, use ___iterableItem___:
// In Action script
const currentItem = ___iterableItem___;
// Example: processing order items
print('Processing item:', currentItem.name);
print('Price:', currentItem.price);
print('Quantity:', currentItem.quantity);
// Build output
output = {
itemId: currentItem.id,
processed: true,
timestamp: new Date().toISOString()
};
Iterable Use Cases
| Use Case | Logic Field | Description |
|---|---|---|
| Batch Notifications | message.recipients | Send notification to each recipient |
| Order Processing | message.order.items | Process each item in an order |
| Multi-Platform Posting | message.platforms | Post to multiple social platforms |
| Bulk Data Processing | message.records | Process each record in a batch |
Visual Indicator
On the workflow canvas, Iterable connections display with a special marker (loop icon) to indicate the iteration behavior.
Troubleshooting
Event not triggering
- Check the condition matches your message format
- Verify the workflow is Active
- Check that organizationId and environmentId match
Prompt returning empty
- Verify the AI model is configured correctly
- Check the model has valid credentials
- Review the prompt template for syntax errors
Action script errors
- Check the browser console and server logs
- Ensure you're using
awaitwith async functions - Verify variable names match the injected functions
Workflow not saving
- Ensure all nodes are connected
- Every workflow needs at least one Event
- Check for circular connections (not allowed)
Next Steps
Now that you've built a basic workflow, try:
- Add more complexity - Use True/False branching to handle different scenarios
- Integrate external services - Post to Mastodon, store in S3, query Pinecone
- Chain AI calls - Use multiple prompts in sequence for complex processing
- Use the AI Assistant - Ask it to create entities for you
Related Topics
- Workflow Patterns - Common workflow architectures
- Workflow Data Schema - Complete JSON reference
- Script Functions - Available script functions
- Conditions - Condition configuration