The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Haiflow Chain - Step 2: Multiply by 5",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "calc-step1-done",
"responseMode": "onReceived"
},
"id": "webhook-1",
"name": "Pipeline Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
240,
300
],
"notes": "Receives { topic, sourceSession, taskId, message, publishedAt } from haiflow pipeline when calc.step1.done fires."
},
{
"parameters": {
"jsCode": "const message = $input.first().json.body.message || '';\nconst numbers = message.match(/\\d+/g);\nconst previousResult = numbers ? numbers[numbers.length - 1] : message.trim();\nreturn [{ json: { previousResult, prompt: `Take the number ${previousResult} and multiply it by 5. Reply with ONLY the numeric result, nothing else.` } }];"
},
"id": "extract-1",
"name": "Build Prompt",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
460,
300
]
},
{
"parameters": {
"method": "POST",
"url": "http://localhost:3333/session/start",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ cwd: '/tmp', session: 'calc-step2' }) }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer {{ $env.HAIFLOW_API_KEY }}"
}
]
},
"options": {}
},
"id": "start-1",
"name": "Start Session",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
680,
300
]
},
{
"parameters": {
"method": "POST",
"url": "http://localhost:3333/trigger",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ prompt: $('Build Prompt').first().json.prompt, session: 'calc-step2', id: 'calc2-' + Date.now(), source: 'n8n' }) }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer {{ $env.HAIFLOW_API_KEY }}"
}
]
},
"options": {}
},
"id": "trigger-1",
"name": "Trigger Haiflow",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
900,
300
]
},
{
"parameters": {
"url": "=http://localhost:3333/responses/{{ $json.id }}/stream?session=calc-step2&timeout=300",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer {{ $env.HAIFLOW_API_KEY }}"
}
]
},
"options": {
"timeout": 310000,
"response": {
"response": {
"responseFormat": "text",
"neverError": true
}
}
}
},
"id": "stream-1",
"name": "Stream Response",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
1120,
300
]
},
{
"parameters": {
"jsCode": "const text = $input.first().json.data || '';\nfor (const block of text.split('\\n\\n').reverse()) {\n if (block.includes('event: complete')) {\n const line = block.split('\\n').find(l => l.startsWith('data: '));\n if (line) return [{ json: JSON.parse(line.slice(6)) }];\n }\n}\nreturn [{ json: { error: 'Task did not complete', raw: text } }];"
},
"id": "parse-1",
"name": "Parse SSE Response",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1340,
300
]
},
{
"parameters": {
"method": "POST",
"url": "http://localhost:3333/session/stop",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ session: 'calc-step2' }) }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer {{ $env.HAIFLOW_API_KEY }}"
}
]
},
"options": {}
},
"id": "stop-1",
"name": "Stop Session",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
1560,
300
]
},
{
"parameters": {
"jsCode": "const messages = $('Parse SSE Response').first().json.messages || [];\nconst result = messages.join('\\n').trim();\nreturn [{ json: { step: 2, prompt: 'Multiply previous result by 5', result, messages } }];"
},
"id": "log-1",
"name": "Log Result",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1780,
300
]
}
],
"connections": {
"Pipeline Webhook": {
"main": [
[
{
"node": "Build Prompt",
"type": "main",
"index": 0
}
]
]
},
"Build Prompt": {
"main": [
[
{
"node": "Start Session",
"type": "main",
"index": 0
}
]
]
},
"Start Session": {
"main": [
[
{
"node": "Trigger Haiflow",
"type": "main",
"index": 0
}
]
]
},
"Trigger Haiflow": {
"main": [
[
{
"node": "Stream Response",
"type": "main",
"index": 0
}
]
]
},
"Stream Response": {
"main": [
[
{
"node": "Parse SSE Response",
"type": "main",
"index": 0
}
]
]
},
"Parse SSE Response": {
"main": [
[
{
"node": "Stop Session",
"type": "main",
"index": 0
}
]
]
},
"Stop Session": {
"main": [
[
{
"node": "Log Result",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Haiflow Chain - Step 2: Multiply by 5. Uses httpRequest. Webhook trigger; 8 nodes.
Source: https://github.com/andersonaguiar/haiflow/blob/main/examples/chained-calc/chained-calc-step2.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This n8n template provides enterprise-level version control for your workflows using GitHub integration. Stop losing hours to broken workflows and manual exports – get proper commit history, visual di
This flow creates dummy files for every item added in your *Arrs (Radarr/Sonarr) with the tag .
eek-Go v2 (Batch-Then-Review). Uses httpRequest. Webhook trigger; 75 nodes.
This workflow receives webhook requests from a content calendar and uses the X API v2 to publish text posts, threads, image/video posts, and polls, as well as delete existing posts and run a credentia
This workflow acts as a central API gateway for all technical indicator agents in the Binance Spot Market Quant AI system. It listens for incoming webhook requests and dynamically routes them to the c