126 lines
3.5 KiB
JSON
126 lines
3.5 KiB
JSON
{
|
|
"name": "robeing-skill-calendar-request",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "skills/calendar/request",
|
|
"responseMode": "responseNode",
|
|
"options": {}
|
|
},
|
|
"id": "cal-req-001",
|
|
"name": "Webhook In",
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 1,
|
|
"position": [200, 240]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "const body = $json.body || {};\nconst action = body.action || 'query'; // 'create', 'query', 'delete'\nreturn {\n action,\n user_id: body.user_id,\n robeing_id: body.robeing_id || 'rb8001',\n query: body.query || '',\n event_data: body.event_data || {},\n event_id: body.event_id || ''\n};"
|
|
},
|
|
"id": "cal-req-002",
|
|
"name": "Normalize Payload",
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [440, 240]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"conditions": {
|
|
"string": [
|
|
{
|
|
"value1": "={{ $json.action }}",
|
|
"operation": "equals",
|
|
"value2": "create"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"id": "cal-req-003",
|
|
"name": "Action Type",
|
|
"type": "n8n-nodes-base.if",
|
|
"typeVersion": 2,
|
|
"position": [680, 240]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "POST",
|
|
"url": "=http://192.168.219.52:8512/api/events",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "X-User-Id",
|
|
"value": "={{ $json.user_id }}"
|
|
}
|
|
]
|
|
},
|
|
"sendBody": true,
|
|
"specifyBody": "json",
|
|
"jsonBody": "={{ $json.event_data }}",
|
|
"options": {}
|
|
},
|
|
"id": "cal-req-004",
|
|
"name": "Create Event",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [940, 160]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"method": "GET",
|
|
"url": "=http://192.168.219.52:8512/api/events",
|
|
"sendHeaders": true,
|
|
"headerParameters": {
|
|
"parameters": [
|
|
{
|
|
"name": "X-User-Id",
|
|
"value": "={{ $json.user_id }}"
|
|
}
|
|
]
|
|
},
|
|
"qs": {
|
|
"parameters": [
|
|
{
|
|
"name": "query",
|
|
"value": "={{ $json.query }}"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"id": "cal-req-005",
|
|
"name": "Query Events",
|
|
"type": "n8n-nodes-base.httpRequest",
|
|
"typeVersion": 4.2,
|
|
"position": [940, 320]
|
|
},
|
|
{
|
|
"parameters": {
|
|
"respondWith": "json",
|
|
"responseBody": "={{ $json.body || $json }}",
|
|
"options": {}
|
|
},
|
|
"id": "cal-req-006",
|
|
"name": "Return Result",
|
|
"type": "n8n-nodes-base.respondToWebhook",
|
|
"typeVersion": 1,
|
|
"position": [1220, 240]
|
|
}
|
|
],
|
|
"connections": {
|
|
"Webhook In": { "main": [[{ "node": "Normalize Payload", "type": "main", "index": 0 }]] },
|
|
"Normalize Payload": { "main": [[{ "node": "Action Type", "type": "main", "index": 0 }]] },
|
|
"Action Type": {
|
|
"main": [
|
|
[{ "node": "Create Event", "type": "main", "index": 0 }],
|
|
[{ "node": "Query Events", "type": "main", "index": 0 }]
|
|
]
|
|
},
|
|
"Create Event": { "main": [[{ "node": "Return Result", "type": "main", "index": 0 }]] },
|
|
"Query Events": { "main": [[{ "node": "Return Result", "type": "main", "index": 0 }]] }
|
|
},
|
|
"pinData": {},
|
|
"meta": { "templateCredsSetupCompleted": true, "instanceId": "robeing-skills" }
|
|
}
|