{
"name": "My workflow",
"nodes": [
{
"parameters": {
"method": "POST",
"url": "https://api.maiagent.ai/api/v1/chatbots/{id}/completions/",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Api-Key YOUR_API_KEY"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"conversation\": \"\",\n \"message\": {\n \"content\": \"{{ $json.chatInput }}\",\n \"attachments\": []\n },\n \"is_streaming\": false\n} ",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-240,
-180
],
"id": "dfc1157d-7569-4caf-8b1d-256aa74515ac",
"name": "HTTP Request"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"typeVersion": 1.1,
"position": [
-500,
-180
],
"id": "82748324-6021-4660-98ef-481bdfc73569",
"name": "When chat message received",
"webhookId": "5f833c90-a7f9-4c66-8fff-cecc3568cd2a"
},
{
"parameters": {
"method": "POST",
"url": "https://api.maiagent.ai/api/v1/chatbots/{id}/completions/",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Api-Key YOUR_API_KEY"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"conversation\": \"\",\n \"message\": {\n \"content\": {{ JSON.stringify($json.content) }},\n \"attachments\": []\n },\n \"is_streaming\": false\n} ",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
20,
-180
],
"id": "f0a80b1f-1bed-491b-bc5e-cddb87ccd2d5",
"name": "HTTP Request1"
}
],
"pinData": {},
"connections": {
"When chat message received": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "HTTP Request1",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request1": {
"main": [
[]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "c914db70-985a-48d0-a1ca-47c2a0d4f244",
"meta": {
"instanceId": "2eb51fcaa84ba34149e7fc138f6cac3b20a0038764b284579d6ceaea90b669f8"
},
"id": "pvMcKA5hHmwAKuZT",
"tags": []
}