8
n8n 中文网amn8n.com

Telegram每日任务提醒机器人

高级

这是一个Personal Productivity领域的自动化工作流,包含 27 个节点。主要使用 If, Slack, Switch, Webhook, Postgres 等节点。 集成Telegram、邮件和Slack的多渠道任务提醒系统

前置要求
  • Slack Bot Token 或 Webhook URL
  • HTTP Webhook 端点(n8n 会自动生成)
  • PostgreSQL 数据库连接信息
  • Telegram Bot Token
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "vYPcNPEQKZxdQRgo",
  "meta": {
    "instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
    "templateCredsSetupCompleted": true
  },
  "name": "Telegram 每日任务提醒机器人",
  "tags": [],
  "nodes": [
    {
      "id": "d085b82b-f923-4d83-941d-2020134b704e",
      "name": "Webhook - 接收任务",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -768,
        448
      ],
      "webhookId": "task-YOUR_OPENAI_KEY_HERE-webhook",
      "parameters": {
        "path": "task-YOUR_OPENAI_KEY_HERE-webhook",
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "090aecda-2c33-405d-a602-aaa55fd435cd",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -896,
        80
      ],
      "parameters": {
        "color": 4,
        "width": 380,
        "height": 500,
        "content": "## 📥 WEBHOOK 入口点"
      },
      "typeVersion": 1
    },
    {
      "id": "eb5810b6-3e18-4ef0-ae8c-e0cf1b3a6743",
      "name": "验证输入",
      "type": "n8n-nodes-base.if",
      "position": [
        -304,
        448
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "validation-1",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              },
              "leftValue": "={{ $json.body.userId }}",
              "rightValue": ""
            },
            {
              "id": "validation-2",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              },
              "leftValue": "={{ $json.body.taskName }}",
              "rightValue": ""
            },
            {
              "id": "validation-3",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              },
              "leftValue": "={{ $json.body.reminderTime }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "27bf912f-31f5-411d-ae7a-0cf5d12c49b0",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        160
      ],
      "parameters": {
        "color": 5,
        "width": 408,
        "height": 424,
        "content": "## ✅ 输入验证"
      },
      "typeVersion": 1
    },
    {
      "id": "7a358fe1-7841-4533-bf48-bf1170d3aa22",
      "name": "保存任务到数据库",
      "type": "n8n-nodes-base.postgres",
      "position": [
        128,
        352
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "="
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "credentials": {
        "postgres": {
          "id": "4Y4qEFGqF2krfRHZ",
          "name": "Postgres-test"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "d39c06bd-11f1-4dd7-9213-c5e251845242",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 380,
        "height": 496,
        "content": "## 💾 数据库存储"
      },
      "typeVersion": 1
    },
    {
      "id": "e76eb098-e71b-4689-9830-0ac1c59e46f4",
      "name": "成功响应",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        464,
        352
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ {\n  \"success\": true,\n  \"message\": \"Task created successfully!\",\n  \"taskId\": $json.id,\n  \"taskName\": $json.task_name,\n  \"reminderTime\": $json.reminder_time\n} }}"
      },
      "typeVersion": 1
    },
    {
      "id": "b3cdb19e-6342-4881-937c-651f34b37699",
      "name": "错误响应",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        128,
        544
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ {\n  \"success\": false,\n  \"message\": \"Invalid input. Required fields: userId, taskName, reminderTime\"\n} }}"
      },
      "typeVersion": 1
    },
    {
      "id": "07e622f7-7f07-4998-b150-88cd1d75324e",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        64
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 432,
        "content": "## 📤 响应处理程序"
      },
      "typeVersion": 1
    },
    {
      "id": "054df4ef-2851-442b-ac8e-45d0acd2b9de",
      "name": "计划触发器 - 每 5 分钟",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -768,
        1040
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "*/5 * * * *"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "110f25f1-6f56-4970-a783-3e6878231d22",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        752
      ],
      "parameters": {
        "color": 4,
        "width": 408,
        "height": 456,
        "content": "## ⏰ 计划触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "bffcb07b-e5c5-4587-8795-4a316841772e",
      "name": "获取到期任务",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -352,
        1040
      ],
      "parameters": {
        "query": "SELECT * FROM tasks WHERE status = 'pending' AND reminder_time <= NOW() + INTERVAL '5 minutes' AND reminder_time > NOW()",
        "options": {},
        "operation": "executeQuery"
      },
      "credentials": {
        "postgres": {
          "id": "4Y4qEFGqF2krfRHZ",
          "name": "Postgres-test"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "db4232c9-65fa-4be0-8594-582cb64be001",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        768
      ],
      "parameters": {
        "color": 6,
        "width": 360,
        "height": 416,
        "content": "## 🔍 获取到期任务"
      },
      "typeVersion": 1
    },
    {
      "id": "2f074a5a-5441-4cd9-bedc-36a80b2f0442",
      "name": "检查任务是否存在",
      "type": "n8n-nodes-base.if",
      "position": [
        16,
        1056
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "has-tasks",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.length }}",
              "rightValue": "0"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "8fb3b2a4-31f4-4e57-a8fc-e5f2e19502ab",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        784
      ],
      "parameters": {
        "color": 5,
        "width": 320,
        "height": 408,
        "content": "## 🔀 任务检查器"
      },
      "typeVersion": 1
    },
    {
      "id": "0284e84a-4b41-407d-9ca2-02950123b14e",
      "name": "拆分为项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        464,
        880
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "2a67a9a4-4317-48fa-b7d4-c666578d27f3",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        672
      ],
      "parameters": {
        "color": 3,
        "width": 304,
        "height": 360,
        "content": "## 🔄 拆分为项目"
      },
      "typeVersion": 1
    },
    {
      "id": "34887349-bfcb-4d72-aa3b-80c17cd64188",
      "name": "按渠道路由",
      "type": "n8n-nodes-base.switch",
      "position": [
        864,
        368
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "",
                    "rightValue": ""
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "7d8f1cb8-3c6e-4e0b-9d83-729b1927ec99",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 404,
        "content": "## 📨 渠道路由器"
      },
      "typeVersion": 1
    },
    {
      "id": "94e39533-9cf6-49ee-9c8b-0b785895d37e",
      "name": "发送电子邮件提醒",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1264,
        352
      ],
      "webhookId": "057f2dc9-1e5b-4000-88b7-571def9c2710",
      "parameters": {
        "options": {},
        "subject": "⏰ Task Reminder: {{ $json.task_name }}",
        "toEmail": "={{ $json.user_id }}",
        "fromEmail": "noreply@yourdomain.com"
      },
      "credentials": {
        "smtp": {
          "id": "G1kyF8cSWTZ4vouN",
          "name": "SMTP -test"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0f0d5935-a428-4616-b230-4a0fcb109a9f",
      "name": "便签 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        48
      ],
      "parameters": {
        "color": 4,
        "width": 340,
        "height": 452,
        "content": "## 📧 电子邮件发送器"
      },
      "typeVersion": 1
    },
    {
      "id": "5e0425d6-ed82-4eda-8a0e-80d3fbd8e78f",
      "name": "发送 Slack 提醒",
      "type": "n8n-nodes-base.slack",
      "position": [
        944,
        848
      ],
      "webhookId": "b9174638-d248-446d-ae09-4b612dd6b4f4",
      "parameters": {
        "text": "=🔔 *Task Reminder*\n\n*Task:* {{ $json.task_name }}\n*Time:* {{ $json.reminder_time }}\n*Description:* {{ $json.description || 'No description' }}",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "select": "user",
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "MQ0fgwuS8AzfwFvy",
          "name": "Slack account - test "
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ed8ca2c7-a374-473a-a35e-a245b434e50c",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        544
      ],
      "parameters": {
        "color": 5,
        "width": 404,
        "height": 436,
        "content": "## 💬 Slack 发送器"
      },
      "typeVersion": 1
    },
    {
      "id": "5f99e3b6-6458-465c-a300-a64d3e4885b8",
      "name": "发送 Telegram 提醒",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1392,
        1248
      ],
      "webhookId": "ad2c97dc-cfbb-480e-99be-6d7c50ca84b4",
      "parameters": {
        "text": "=🔔 *Task Reminder*\n\n*Task:* {{ $json.task_name }}\n*Time:* {{ $json.reminder_time }}\n*Description:* {{ $json.description || 'No description' }}",
        "chatId": "={{ $json.user_id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "3ubbGgZx2YzylQZu",
          "name": "Telegram account - test"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "efa080e8-9ddd-4ba8-9ffe-01bcd0400bab",
      "name": "便签11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        976
      ],
      "parameters": {
        "color": 6,
        "width": 340,
        "height": 424,
        "content": "## 📱 Telegram 发送器"
      },
      "typeVersion": 1
    },
    {
      "id": "cc667e2b-5728-4ef9-a54b-4eac33d69b74",
      "name": "更新任务状态",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1696,
        848
      ],
      "parameters": {
        "query": "=UPDATE tasks SET status = 'sent', sent_at = NOW() WHERE id = {{ $json.id }}",
        "options": {},
        "operation": "executeQuery"
      },
      "credentials": {
        "postgres": {
          "id": "4Y4qEFGqF2krfRHZ",
          "name": "Postgres-test"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "695a7588-6cec-4fd9-942a-c63fca8ede0a",
      "name": "便签13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1552,
        384
      ],
      "parameters": {
        "color": 2,
        "width": 400,
        "height": 616,
        "content": "## 🎯 工作流完成!"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6f4e3cb7-fd01-44eb-bd5b-b223b34ae217",
  "connections": {
    "Validate Input": {
      "main": [
        [
          {
            "node": "Save Task to Database",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Due Tasks": {
      "main": [
        [
          {
            "node": "Check Tasks Exist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Channel": {
      "main": [
        [
          {
            "node": "Send Email Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Into Items": {
      "main": [
        [
          {
            "node": "Route by Channel",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Slack Reminder",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Telegram Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Tasks Exist": {
      "main": [
        [
          {
            "node": "Split Into Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Task Status": {
      "main": [
        [
          {
            "node": "Split Into Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email Reminder": {
      "main": [
        [
          {
            "node": "Update Task Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Slack Reminder": {
      "main": [
        [
          {
            "node": "Update Task Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Task to Database": {
      "main": [
        [
          {
            "node": "Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Telegram Reminder": {
      "main": [
        [
          {
            "node": "Update Task Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook - Receive Task": {
      "main": [
        [
          {
            "node": "Validate Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger - Every 5 Minutes": {
      "main": [
        [
          {
            "node": "Fetch Due Tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 个人效率

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量27
分类1
节点类型11
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Oneclick AI Squad

Oneclick AI Squad

@oneclick-ai

The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.

外部链接
在 n8n.io 查看

分享此工作流