Weather Bot
Shared 8/7/2025
287 views
Visual Workflow
JSON Code
{
"meta": {
"instanceId": "51bcc81a9971e31be7b16425122bc26f72096598c09d614359e918748a75dec1",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "a294f3ab-c721-4376-825b-8a3ee686e00d",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-192,
-80
],
"webhookId": "05610e94-043f-44e7-8673-9e18c1000ba2",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "2MhfljH3vHvpYIME",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "e71be810-919d-437d-aa33-ac4ee676229f",
"name": "Code",
"type": "n8n-nodes-base.code",
"position": [
16,
-80
],
"parameters": {
"jsCode": "const message = items[0].json.message;\n\nif (message && message.text) {\n const city = message.text.toLowerCase();\n return [{ json: { city: city } }];\n} else {\n return [{ json: { error: 'No text message found or message format is incorrect.' } }];\n}"
},
"typeVersion": 2
},
{
"id": "6577e6a4-e0ff-4f24-aa7d-91501e0f6eb7",
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"position": [
224,
-80
],
"parameters": {
"url": "https://api.openweathermap.org/data/2.5/weather",
"options": {
"response": {
"response": {
"responseFormat": "json"
}
}
},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "q",
"value": "=={{$json.city}}"
},
{
"name": "appid",
"value": "e1e6a49713fc764e7dcd0a738a910978"
},
{
"name": "units",
"value": "metric"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "a0d08545-04c8-49d5-871d-48cf3a229ce1",
"name": "Send a text message",
"type": "n8n-nodes-base.telegram",
"position": [
432,
-80
],
"webhookId": "95988c1b-48bb-44bc-bdf7-31097128fd12",
"parameters": {
"text": "=It's currently {{$json.main.temp}}°C in {{$json.name}} with {{$json.weather[0].description}}. The humidity is {{$json.main.humidity}}%.",
"chatId": "=={{$json.body.message.chat.id}}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "2MhfljH3vHvpYIME",
"name": "Telegram account"
}
},
"typeVersion": 1.2
}
],
"pinData": {},
"connections": {
"Code": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Send a text message",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
}
}
}