使用 OpenWeatherMap 和 Telegram 机器人发送每日天气报告
中级
这是一个Personal Productivity, Miscellaneous, Multimodal AI领域的自动化工作流,包含 10 个节点。主要使用 Cron, Function, Telegram, OpenWeatherMap 等节点。 每日天气报告:OpenWeatherMap 和 Telegram 机器人
前置要求
- •Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "zVk8lAovJaOKMXFR",
"meta": {
"instanceId": "ade915387b18f7a3b9a14fd8fb677fdbace0ade794de7914e8790d907cd285d0"
},
"name": "使用 OpenWeatherMap 和 Telegram 机器人发送每日天气报告",
"tags": [],
"nodes": [
{
"id": "b707258f-7424-4199-887b-20cd21728102",
"name": "工作流概述",
"type": "n8n-nodes-base.stickyNote",
"position": [
-832,
-352
],
"parameters": {
"width": 300,
"height": 392,
"content": "## 🤖 自动化天气机器人"
},
"typeVersion": 1
},
{
"id": "f55bdbef-30ef-4759-815c-8168bbb0d6b8",
"name": "定时触发器",
"type": "n8n-nodes-base.cron",
"position": [
-624,
64
],
"parameters": {},
"typeVersion": 1
},
{
"id": "1de1ccc6-b87a-4af6-bc11-0903dc740edd",
"name": "日程设置",
"type": "n8n-nodes-base.stickyNote",
"position": [
-816,
224
],
"parameters": {
"width": 280,
"height": 296,
"content": "⏰ **计划触发器**"
},
"typeVersion": 1
},
{
"id": "954baa8c-530b-4bcc-bff9-00e841bdf7dd",
"name": "获取天气",
"type": "n8n-nodes-base.openWeatherMap",
"position": [
-400,
64
],
"parameters": {
"cityName": "Kielce,PL",
"language": "en"
},
"typeVersion": 1
},
{
"id": "8aed3c70-bc04-4a27-8d1b-46ae41a38bbf",
"name": "天气 API",
"type": "n8n-nodes-base.stickyNote",
"position": [
-496,
224
],
"parameters": {
"width": 248,
"height": 296,
"content": "🌤️ **天气数据**"
},
"typeVersion": 1
},
{
"id": "124a7ab9-52a1-4e4c-8735-787bb27083b5",
"name": "格式化天气",
"type": "n8n-nodes-base.function",
"position": [
-176,
64
],
"parameters": {
"functionCode": "const weather = items[0].json;\n\nfunction formatTime(timestamp, timezoneOffset) {\n const date = new Date((timestamp + timezoneOffset) * 1000);\n return date.toISOString().substr(11, 5);\n}\n\nconst city = weather.name;\nconst temp = weather.main.temp.toFixed(1);\nconst tempMin = weather.main.temp_min.toFixed(1);\nconst tempMax = weather.main.temp_max.toFixed(1);\nconst feelsLike = weather.main.feels_like.toFixed(1);\nconst description = weather.weather[0].description;\nconst rain = weather.rain ? weather.rain[\"1h\"] : 0;\nconst windSpeed = weather.wind.speed.toFixed(1);\nconst windDeg = weather.wind.deg;\nconst clouds = weather.clouds.all;\nconst sunrise = formatTime(weather.sys.sunrise, weather.timezone);\nconst sunset = formatTime(weather.sys.sunset, weather.timezone);\n\nconst message = `Weather in ${city}:\n🌡 Temperature: ${temp}°C (feels like: ${feelsLike}°C)\n📉 Min: ${tempMin}°C, 📈 Max: ${tempMax}°C\n🌧 Precipitation: ${description}, ${rain} mm in the last hour\n💨 Wind: ${windSpeed} m/s, direction ${windDeg}°\n☁️ Cloudiness: ${clouds}%\n🌅 Sunrise: ${sunrise}\n🌇 Sunset: ${sunset}`;\n\nreturn [{ json: { message } }];"
},
"typeVersion": 1
},
{
"id": "86c09047-c113-40ca-a606-0225b8ad19f2",
"name": "消息格式化",
"type": "n8n-nodes-base.stickyNote",
"position": [
-224,
232
],
"parameters": {
"width": 200,
"height": 288,
"content": "📝 **格式化消息**"
},
"typeVersion": 1
},
{
"id": "494899d5-16e9-44a4-acf9-190087e14bee",
"name": "发送文本消息",
"type": "n8n-nodes-base.telegram",
"position": [
64,
64
],
"webhookId": "a1a10685-f8eb-4b97-897f-3c9031e8de55",
"parameters": {
"text": "={{ $json.message }}",
"chatId": "XXXXXXX",
"additionalFields": {}
},
"typeVersion": 1.2
},
{
"id": "3c32825f-b4c7-4b52-938f-8a158be368aa",
"name": "Telegram 发送",
"type": "n8n-nodes-base.stickyNote",
"position": [
16,
224
],
"parameters": {
"width": 200,
"height": 296,
"content": "📱 **发送到 Telegram**"
},
"typeVersion": 1
},
{
"id": "98652765-0a26-42ea-8773-32431f9e7fbb",
"name": "快速入门指南",
"type": "n8n-nodes-base.stickyNote",
"position": [
-352,
-336
],
"parameters": {
"width": 350,
"height": 340,
"content": "🚀 **快速入门:**"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "58aba6a0-c288-45c6-80c0-e1a9f66b21b7",
"connections": {
"Get Weather": {
"main": [
[
{
"node": "Format Weather",
"type": "main",
"index": 0
}
]
]
},
"Format Weather": {
"main": [
[
{
"node": "Send a text message",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get Weather",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 个人效率, 杂项, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
肯定发送器 + 每周感恩摘要(健康)v2
使用Notion、邮件和Telegram的每日肯定语和每周感恩摘要
If
Set
Cron
+9
26 节点Shelly-Ann Davy
个人效率
家庭与业务周度节奏规划器 (v1)
每周业务与家庭任务规划器(Notion、邮件摘要和Telegram)
If
Set
Cron
+7
20 节点Shelly-Ann Davy
个人效率
自动化Google Drive到FTP文件传输与JSON日志记录和报告
自动化Google Drive到FTP文件传输与JSON日志记录和报告
If
Ftp
Code
+7
15 节点Dariusz Koryto
文件管理
Telegram和Google Sheets费用记录:周度汇总与预算提醒
Telegram和Google Sheets费用记录:周度汇总与预算提醒
Code
Telegram
Google Sheets
+3
15 节点Gtaras
个人效率
德国公寓查找器和自动申请(带便签功能)
自动德国公寓搜索与申请,集成Immobilienscout24和Google服务
Set
Cron
Function
+6
22 节点Abbas Ali
个人效率
CoinGecko热门币种
从CoinGecko自动推送热门加密货币更新到Telegram
Function
Telegram
Http Request
+3
6 节点CryptooChai
加密货币交易