hey is this a proper json code i can paste in n8n to create my workflow?: {
"meta": {
"instanceId": "your-instance-id"
},
"nodes": [
{
"parameters": {
"updates": [
{
"updateKey": "message"
}
]
},
"id": "Telegram Trigger",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1,
"position": [
200,
300
],
"credentials": {
"telegramApi": {
"id": "YOUR_TELEGRAM_CREDENTIALS",
"name": "YOUR_TELEGRAM_CREDENTIALS"
}
}
},
{
"parameters": {
"operation": "get",
"key": "={{json[\"message\"][\"chat\"][\"id\"]}}"
},
"id": "Get State",
"name": "Get State",
"type": "n8n-nodes-base.dataStore",
"typeVersion": 1,
"position": [
400,
300
]
},
{
"parameters": {
"property": "={{json["state"] || ""}}",
"rules": [
{
"value": "",
"operation": "equal"
},
{
"value": "awaiting_location",
"operation": "equal"
},
{
"value": "awaiting_job_title",
"operation": "equal"
},
{
"value": "awaiting_gender",
"operation": "equal"
},
{
"value": "complete",
"operation": "equal"
}
]
},
"id": "Switch State",
"name": "Switch State",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
600,
300
]
},
{
"parameters": {
"operation": "sendMessage",
"chatId": "={{json[\"message\"][\"chat\"][\"id\"]}}",
"text": "What location are you searching for?"
},
"id": "Ask Location",
"name": "Ask Location",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
800,
100
],
"credentials": {
"telegramApi": {
"id": "YOUR_TELEGRAM_CREDENTIALS",
"name": "YOUR_TELEGRAM_CREDENTIALS"
}
}
},
{
"parameters": {
"operation": "set",
"key": "={{json["message"]["chat"]["id"]}}",
"value": "{"state":"awaiting_location"}"
},
"id": "Set Awaiting Location",
"name": "Set Awaiting Location",
"type": "n8n-nodes-base.dataStore",
"typeVersion": 1,
"position": [
1000,
100
]
},
{
"parameters": {
"operation": "set",
"key": "={{json[\"message\"][\"chat\"][\"id\"]}}",
"value": "={{JSON.stringify({state: 'awaiting_job_title', location: json["message"]["text"]})}}"
},
"id": "Set Location",
"name": "Set Location",
"type": "n8n-nodes-base.dataStore",
"typeVersion": 1,
"position": [
800,
200
]
},
{
"parameters": {
"operation": "sendMessage",
"chatId": "={{json[\"message\"][\"chat\"][\"id\"]}}",
"text": "What job title are you looking for?"
},
"id": "Ask Job Title",
"name": "Ask Job Title",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
1000,
200
],
"credentials": {
"telegramApi": {
"id": "YOUR_TELEGRAM_CREDENTIALS",
"name": "YOUR_TELEGRAM_CREDENTIALS"
}
}
},
{
"parameters": {
"operation": "set",
"key": "={{json["message"]["chat"]["id"]}}",
"value": "={{JSON.stringify({state: 'awaiting_gender', location: json[l¨ocation]¨∣∣json["message"]["text"], job_title: json[\"message\"][\"text\"]})}}"
},
"id": "Set Job Title",
"name": "Set Job Title",
"type": "n8n-nodes-base.dataStore",
"typeVersion": 1,
"position": [
800,
300
]
},
{
"parameters": {
"operation": "sendMessage",
"chatId": "={{json["message"]["chat"]["id"]}}",
"text": "What is the gender you are looking for? (Male/Female/Any)"
},
"id": "Ask Gender",
"name": "Ask Gender",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
1000,
300
],
"credentials": {
"telegramApi": {
"id": "YOUR_TELEGRAM_CREDENTIALS",
"name": "YOUR_TELEGRAM_CREDENTIALS"
}
}
},
{
"parameters": {
"operation": "set",
"key": "={{json[\"message\"][\"chat\"][\"id\"]}}",
"value": "={{JSON.stringify({state: 'complete', location: json["location"], job_title: json[j¨obtitle]json["message"]["text"]})}}"
},
"id": "Set Gender & Complete",
"name": "Set Gender & Complete",
"type": "n8n-nodes-base.dataStore",
"typeVersion": 1,
"position": [
800,
400
]
},
{
"parameters": {
"operation": "get",
"key": "={{json[\"message\"][\"chat\"][\"id\"]}}"
},
"id": "Get Complete State",
"name": "Get Complete State",
"type": "n8n-nodes-base.dataStore",
"typeVersion": 1,
"position": [
1000,
400
]
},
{
"parameters": {
"functionCode": "const state = JSON.parse(items[0].json.value);\nreturn [{json: {...state, chat_id: json["message"]["chat"]["id"]}}];"
},
"id": "Parse State",
"name": "Parse State",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
1200,
400
]
},
{
"parameters": {
"url": "[SCRAPING_API_ENDPOINT]",
"method": "POST",
"responseFormat": "json",
"jsonParameters": true,
"options": {},
"bodyParametersJson": "={\n "location": json[l¨ocation]¨,\njson["job_title"],\n "gender": json[\"gender\"]\n}"
},
"id": "Call Scraping API",
"name": "Call Scraping API",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1400,
400
]
},
{
"parameters": {
"functionCode": "// Assume API returns { results: [ {name, title, location, gender}, ... ] }\nconst people = items[0].json.results || [];\nlet message = '';\nif (people.length === 0) {\n message = 'No matching personnel found.';\n} else {\n message = 'Here are the matching personnel:\\n\\n';\n people.forEach((person, idx) => {\n message += `{idx + 1}. Name: person.namenTitle:{person.title}\n Location: person.locationnGender:{person.gender}\n\n`;\n });\n}\nreturn [{json: {message, chat_id: json[\"chat_id\"]}}];"
},
"id": "Format Results",
"name": "Format Results",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
1600,
400
]
},
{
"parameters": {
"operation": "sendMessage",
"chatId": "={{json["chat_id"]}}",
"text": "={{json[\"message\"]}}"
},
"id": "Send Results",
"name": "Send Results",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
1800,
400
],
"credentials": {
"telegramApi": {
"id": "YOUR_TELEGRAM_CREDENTIALS",
"name": "YOUR_TELEGRAM_CREDENTIALS"
}
}
},
{
"parameters": {
"operation": "delete",
"key": "={{json["chat_id"]}}"
},
"id": "Clear State",
"name": "Clear State",
"type": "n8n-nodes-base.dataStore",
"typeVersion": 1,
"position": [
2000,
400
]
}
],
"connections": {
"Telegram Trigger": {
"main": [
[
{
"node": "Get State",
"type": "main",
"index": 0
}
]
]
},
"Get State": {
"main": [
[
{
"node": "Switch State",
"type": "main",
"index": 0
}
]
]
},
"Switch State": {
"main": [
[
{
"node": "Ask Location",
"type": "main",
"index": 0
},
{
"node": "Set Location",
"type": "main",
"index": 1
},
{
"node": "Set Job Title",
"type": "main",
"index": 2
},
{
"node": "Set Gender & Complete",
"type": "main",
"index": 3
},
{
"node": "Get Complete State",
"type": "main",
"index": 4
}
]
]
},
"Ask Location": {
"main": [
[
{
"node": "Set Awaiting Location",
"type": "main",
"index": 0
}
]
]
},
"Set Awaiting Location": {
"main": [
[]
]
},
"Set Location": {
"main": [
[
{
"node": "Ask Job Title",
"type": "main",
"index": 0
}
]
]
},
"Ask Job Title": {
"main": [
[]
]
},
"Set Job Title": {
"main": [
[
{
"node": "Ask Gender",
"type": "main",
"index": 0
}
]
]
},
"Ask Gender": {
"main": [
[]
]
},
"Set Gender & Complete": {
"main": [
[
{
"node": "Get Complete State",
"type": "main",
"index": 0
}
]
]
},
"Get Complete State": {
"main": [
[
{
"node": "Parse State",
"type": "main",
"index": 0
}
]
]
},
"Parse State": {
"main": [
[
{
"node": "Call Scraping API",
"type": "main",
"index": 0
}
]
]
},
"Call Scraping API": {
"main": [
[
{
"node": "Format Results",
"type": "main",
"index": 0
}
]
]
},
"Format Results": {
"main": [
[
{
"node": "Send Results",
"type": "main",
"index": 0
}
]
]
},
"Send Results": {
"main": [
[
{
"node": "Clear State",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"id": "Personnel Search Agent"
}ù