8
n8n 中文网amn8n.com

基于回复时间的自动化

高级

这是一个Miscellaneous, Multimodal AI领域的自动化工作流,包含 16 个节点。主要使用 If, Set, Wait, Gmail, Function 等节点。 工作时间潜在客户响应系统(Gmail、Google表格和Telegram提醒)

前置要求
  • Google 账号和 Gmail API 凭证
  • Telegram Bot Token
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "RB08fvn7cXuNcJKU",
  "meta": {
    "instanceId": "8443f10082278c46aa5cf3acf8ff0f70061a2c58bce76efac814b16290845177",
    "templateCredsSetupCompleted": true
  },
  "name": "基于回复时间的自动化",
  "tags": [],
  "nodes": [
    {
      "id": "b3eabad0-a164-4795-b945-28aef6495a00",
      "name": "等待 5 分钟",
      "type": "n8n-nodes-base.wait",
      "position": [
        -720,
        0
      ],
      "webhookId": "f91de49f-1455-487f-9c38-5a4be0742f83",
      "parameters": {
        "unit": "minutes",
        "amount": 5
      },
      "typeVersion": 1
    },
    {
      "id": "b0ccf87c-4703-41e8-98ee-79f5ff41b400",
      "name": "检查工作时间",
      "type": "n8n-nodes-base.function",
      "position": [
        -496,
        0
      ],
      "parameters": {
        "functionCode": "return items.map(item => {\n  const timestamp = item.json[\"Time Stamp\"]; // <-- corrected key\n\n  // Convert Excel serial timestamp to JS Date\n  const excelEpoch = new Date(Date.UTC(1899, 11, 30));\n  const jsDate = new Date(excelEpoch.getTime() + timestamp * 24 * 60 * 60 * 1000);\n\n  const day = jsDate.getDay(); // 0=Sunday, 6=Saturday\n  const hour = jsDate.getHours();\n\n  // Configure business hours here\n  const businessDays = [1, 2, 3, 4, 5]; // Mon-Fri\n  const startHour = 9;\n  const endHour = 18;\n\n  let isBusinessHours = false;\n  if (businessDays.includes(day) && hour >= startHour && hour < endHour) {\n    isBusinessHours = true;\n  }\n\n  // Format only the time (HH:mm:ss)\n  const onlyTime = jsDate.toTimeString().substring(0, 8);\n\n  return {\n    json: {\n      ...item.json,\n      exactDateTime: jsDate.toISOString(), // valid datetime for IF node\n      onlyTime,                            // e.g. \"19:05:03\" (for display only)\n      isBusinessHours\n    }\n  };\n});\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a2107454-799e-4c31-b23f-bd586d1eaf86",
      "name": "是否在工作时间?",
      "type": "n8n-nodes-base.if",
      "position": [
        -272,
        0
      ],
      "parameters": {
        "conditions": {
          "dateTime": [
            {
              "value1": "={{ $json.exactDateTime }}",
              "value2": "2025-09-02T18:00:00",
              "operation": "before"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "365df3f2-c7b4-4b47-a1ce-5d12ecc2fbec",
      "name": "发送 Gmail(工作时间)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        176,
        -96
      ],
      "parameters": {
        "toList": [
          "={{ $json[\"Email Address\"] }}"
        ],
        "message": "=Hii {{ $json[\"First Name\"] }}{{ $json[\"Last name\"] }}\n\nThanks for connecting,\nOur team will get back to you soon",
        "subject": "Thanks for reaching out!",
        "resource": "message",
        "additionalFields": {}
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RchiXdmY8WaQhOSJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "40e0ccb1-681b-468d-a046-3d24b32f2a26",
      "name": "发送 Gmail(非工作时间)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        176,
        96
      ],
      "parameters": {
        "toList": [
          "={{ $json[\"Email address\"] }}"
        ],
        "message": "=Hii {{ $json[\"First name\"] }}{{ $json[\"Last name\"] }}\n\nThanks for connecting in after hours\nOur team will get back to you tomorrow",
        "subject": "Thanks for contacting us (After Hours)",
        "resource": "message",
        "additionalFields": {}
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RchiXdmY8WaQhOSJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a2824f7c-78c0-4bb2-92c6-b2f56156908e",
      "name": "通知 Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        400,
        0
      ],
      "webhookId": "93d3561a-1fbd-4114-9459-75994be03027",
      "parameters": {
        "text": "=📩 New lead received!\nName:{{ $('Google Sheets Trigger1').item.json['First Name'] }} {{ $('Google Sheets Trigger1').item.json['Last name'] }} \nEmail: {{ $('Google Sheets Trigger1').item.json['Email Address'] }}\n\nConnect with the lead tomorrow",
        "chatId": "1848105620",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "eoz18tywRndbv87T",
          "name": "Telegram account -anuj"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f56122fd-a759-4f8b-9cef-df47e6787a55",
      "name": "Google Sheets 触发器1",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -944,
        0
      ],
      "parameters": {
        "event": "rowUpdate",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 2142376877,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1NxuC7u6ycvn18f-vyUjvIiYmQ_DJiH7q6YwLndIlLi8/edit#gid=2142376877",
          "cachedResultName": "Form Responses 1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1NxuC7u6ycvn18f-vyUjvIiYmQ_DJiH7q6YwLndIlLi8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1NxuC7u6ycvn18f-vyUjvIiYmQ_DJiH7q6YwLndIlLi8/edit?usp=drivesdk",
          "cachedResultName": "Lead form (Responses)"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "id": "tjY8nawuuRO1rxAE",
          "name": "Google Sheets Trigger account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "319a8e69-f652-4713-aaac-d2365c8fb0e3",
      "name": "获取简报",
      "type": "n8n-nodes-base.set",
      "position": [
        -48,
        96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "70fef5df-53fd-43dc-bd0c-536bd53876f5",
              "name": "First name",
              "type": "string",
              "value": "={{ $('Google Sheets Trigger1').item.json['First name'] }}"
            },
            {
              "id": "e4c87a58-3ac6-427a-aa8b-3f8fe4614173",
              "name": "Last name",
              "type": "string",
              "value": "={{ $('Google Sheets Trigger1').item.json['Last name'] }}"
            },
            {
              "id": "bff7e63c-cf7a-4249-a4a3-8e587abefc91",
              "name": "Email address",
              "type": "string",
              "value": "={{ $('Google Sheets Trigger1').item.json['Email address'] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9761aed1-58b5-4fa6-a6fb-0a2c278ca047",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        -416
      ],
      "parameters": {
        "height": 400,
        "content": "## 节点 1: Google Sheets 触发器1"
      },
      "typeVersion": 1
    },
    {
      "id": "8a747a3f-7199-450e-b73d-e57f407fdd63",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        160
      ],
      "parameters": {
        "height": 336,
        "content": "## 节点 2: 等待 5 分钟"
      },
      "typeVersion": 1
    },
    {
      "id": "b3a3477d-09e9-43b8-85a8-6bda95a18ba1",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -432
      ],
      "parameters": {
        "height": 416,
        "content": "## 节点 3: 检查工作时间"
      },
      "typeVersion": 1
    },
    {
      "id": "4a0f74be-c781-4d0e-8602-629a374666e5",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        144
      ],
      "parameters": {
        "height": 368,
        "content": "## 节点 4: 是否在工作时间?"
      },
      "typeVersion": 1
    },
    {
      "id": "95366c59-2534-4958-9486-69bce28df5db",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -448
      ],
      "parameters": {
        "width": 256,
        "height": 368,
        "content": "## 节点 5: 发送 Gmail(工作时间)"
      },
      "typeVersion": 1
    },
    {
      "id": "a14ce2d8-a41e-4fb1-93e8-60ed91476603",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        256
      ],
      "parameters": {
        "height": 320,
        "content": "## 节点 6: 编辑字段"
      },
      "typeVersion": 1
    },
    {
      "id": "bc1ce307-a9d6-4ccd-94cc-aa432ddc6241",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        256
      ],
      "parameters": {
        "height": 432,
        "content": "## 节点 7: 发送 Gmail(非工作时间)"
      },
      "typeVersion": 1
    },
    {
      "id": "1670bf9f-7bcd-452a-90f0-680fb4a3f969",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        -128
      ],
      "parameters": {
        "height": 368,
        "content": "## 节点 8: 通知 Telegram"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1e243867-6190-4393-8668-3ce609784a0e",
  "connections": {
    "319a8e69-f652-4713-aaac-d2365c8fb0e3": {
      "main": [
        [
          {
            "node": "40e0ccb1-681b-468d-a046-3d24b32f2a26",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b3eabad0-a164-4795-b945-28aef6495a00": {
      "main": [
        [
          {
            "node": "b0ccf87c-4703-41e8-98ee-79f5ff41b400",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a2107454-799e-4c31-b23f-bd586d1eaf86": {
      "main": [
        [
          {
            "node": "365df3f2-c7b4-4b47-a1ce-5d12ecc2fbec",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "319a8e69-f652-4713-aaac-d2365c8fb0e3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b0ccf87c-4703-41e8-98ee-79f5ff41b400": {
      "main": [
        [
          {
            "node": "a2107454-799e-4c31-b23f-bd586d1eaf86",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f56122fd-a759-4f8b-9cef-df47e6787a55": {
      "main": [
        [
          {
            "node": "b3eabad0-a164-4795-b945-28aef6495a00",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "40e0ccb1-681b-468d-a046-3d24b32f2a26": {
      "main": [
        [
          {
            "node": "a2824f7c-78c0-4bb2-92c6-b2f56156908e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "365df3f2-c7b4-4b47-a1ce-5d12ecc2fbec": {
      "main": [
        [
          {
            "node": "a2824f7c-78c0-4bb2-92c6-b2f56156908e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 杂项, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
高级
节点数量16
分类2
节点类型8
难度说明

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

作者
Rahul Joshi

Rahul Joshi

@rahul08

Rahul Joshi is a seasoned technology leader specializing in the n8n automation tool and AI-driven workflow automation. With deep expertise in building open-source workflow automation and self-hosted automation platforms, he helps organizations eliminate manual processes through intelligent n8n ai agent automation solutions.

外部链接
在 n8n.io 查看

分享此工作流

分类

分类: 34