250 lines
5.8 KiB
JSON
250 lines
5.8 KiB
JSON
{
|
|
"name": "OpenHands API Test Workflow",
|
|
"nodes": [
|
|
{
|
|
"parameters": {},
|
|
"id": "manual-trigger",
|
|
"name": "Manual Trigger",
|
|
"type": "n8n-nodes-base.manualTrigger",
|
|
"typeVersion": 1,
|
|
"position": [240, 300]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"url": "http://172.18.0.1:3000/api/conversations",
|
|
"method": "POST",
|
|
"sendBody": true,
|
|
"bodyParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "initial_user_msg",
|
|
"value": "Create a file named hello.txt with content: Hello from n8n automated workflow!"
|
|
}
|
|
]
|
|
},
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"responseFormat": "json"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"id": "create-conversation",
|
|
"name": "Create Conversation",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [460, 300]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"amount": 5,
|
|
"unit": "seconds"
|
|
},
|
|
"id": "wait-5s",
|
|
"name": "Wait 5s",
|
|
"type": "n8n-nodes-base.wait",
|
|
"typeVersion": 1.1,
|
|
"position": [680, 300],
|
|
"webhookId": "wait-5s"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"url": "=http://172.18.0.1:3000/api/conversations/{{ $json.conversation_id }}",
|
|
"method": "GET",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"responseFormat": "json"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"id": "get-status",
|
|
"name": "Get Conversation Status",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [900, 300]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"options": {
|
|
"combineOperation": "any"
|
|
},
|
|
"conditions": [
|
|
{
|
|
"id": "status-running",
|
|
"leftValue": "={{ $json.status }}",
|
|
"rightValue": "RUNNING",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
},
|
|
{
|
|
"id": "status-awaiting",
|
|
"leftValue": "={{ $json.status }}",
|
|
"rightValue": "AWAITING_USER_INPUT",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
},
|
|
{
|
|
"id": "status-stopped",
|
|
"leftValue": "={{ $json.status }}",
|
|
"rightValue": "STOPPED",
|
|
"operator": {
|
|
"type": "string",
|
|
"operation": "equals"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"id": "check-status",
|
|
"name": "Check If Ready",
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2,
|
|
"position": [1120, 300]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"amount": 10,
|
|
"unit": "seconds"
|
|
},
|
|
"id": "wait-more",
|
|
"name": "Wait 10s More",
|
|
"type": "n8n-nodes-base.wait",
|
|
"typeVersion": 1.1,
|
|
"position": [1340, 180],
|
|
"webhookId": "wait-more"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"url": "=http://172.18.0.1:3000/api/conversations/{{ $('Create Conversation').item.json.conversation_id }}/events?limit=20",
|
|
"method": "GET",
|
|
"options": {
|
|
"response": {
|
|
"response": {
|
|
"responseFormat": "json"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"id": "get-events",
|
|
"name": "Get Events",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [1340, 420]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "// Extract conversation ID and status from previous node\nconst convId = $input.item.json.conversation_id || $('Create Conversation').item.json.conversation_id;\nconst status = $input.item.json.status;\nconst runtimeStatus = $input.item.json.runtime_status;\n\nreturn {\n conversation_id: convId,\n status: status,\n runtime_status: runtimeStatus,\n message: `Status: ${status}, Runtime: ${runtimeStatus}`\n};"
|
|
},
|
|
"id": "format-status",
|
|
"name": "Format Status",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [1560, 180]
|
|
}
|
|
],
|
|
"connections": {
|
|
"Manual Trigger": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Create Conversation",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Create Conversation": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Wait 5s",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Wait 5s": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Get Conversation Status",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Get Conversation Status": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Check If Ready",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Check If Ready": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Get Events",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
],
|
|
[
|
|
{
|
|
"node": "Wait 10s More",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Wait 10s More": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Format Status",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Format Status": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Get Conversation Status",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"pinData": {},
|
|
"settings": {
|
|
"executionOrder": "v1"
|
|
},
|
|
"staticData": null,
|
|
"tags": [],
|
|
"triggerCount": 0,
|
|
"updatedAt": "2025-11-29T19:30:00.000Z",
|
|
"versionId": "1"
|
|
}
|