8
n8n 中文网amn8n.com

家长同意自动化

高级

这是一个Document Extraction领域的自动化工作流,包含 22 个节点。主要使用 If, Code, Gmail, Webhook, GoogleDrive 等节点。 使用电子邮件验证、PDF生成和Google Drive自动化学校旅行同意书

前置要求
  • Google 账号和 Gmail API 凭证
  • HTTP Webhook 端点(n8n 会自动生成)
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "",
  "meta": {
    "instanceId": "",
    "templateCredsSetupCompleted": false
  },
  "name": "家长同意自动化",
  "tags": [],
  "nodes": [
    {
      "id": "40acca4a-8547-4085-9786-4f8726b64bd9",
      "name": "便签 - 工作流概览",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1664,
        -256
      ],
      "parameters": {
        "width": 300,
        "height": 356,
        "content": "## 🎯 工作流开始"
      },
      "typeVersion": 1
    },
    {
      "id": "ac6c7f7b-2a2c-4b5a-aafe-91d57abd167d",
      "name": "便签 - 凭证设置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1680,
        112
      ],
      "parameters": {
        "width": 324,
        "height": 440,
        "content": "## 🔑 设置凭据"
      },
      "typeVersion": 1
    },
    {
      "id": "55ca0865-5dff-4f11-8a0e-2051cc12bda3",
      "name": "Webhook 触发器",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1200,
        432
      ],
      "webhookId": "YOUR_WEBHOOK_ID",
      "parameters": {
        "path": "consent",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "id": "546d534e-15d6-4934-a0de-ea9f7298970d",
      "name": "便签 - Webhook",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        112
      ],
      "parameters": {
        "width": 380,
        "height": 456,
        "content": "## 📥 步骤 1: Webhook 触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "63a23027-d8b5-4609-838b-7aaaaa692917",
      "name": "便签 - VerifiEmail",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        272
      ],
      "parameters": {
        "width": 360,
        "height": 308,
        "content": "## 📧 步骤 2: 邮箱验证"
      },
      "typeVersion": 1
    },
    {
      "id": "2cf4c083-899f-43a0-ba3a-39a67eb21c65",
      "name": "IF 邮箱有效",
      "type": "n8n-nodes-base.if",
      "position": [
        -448,
        432
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.valid }}",
              "value2": "={{ true }}"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a59174ce-50f3-479a-8656-9b2fe9af0718",
      "name": "便签 - IF 验证",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        208
      ],
      "parameters": {
        "width": 340,
        "height": 364,
        "content": "## ✅ 步骤 3: 验证检查"
      },
      "typeVersion": 1
    },
    {
      "id": "8f2140b2-9a2c-4e08-a1bf-0037426d9495",
      "name": "错误响应 - 无效邮箱",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -112,
        608
      ],
      "parameters": {
        "options": {
          "responseCode": 400
        },
        "respondWith": "json",
        "responseBody": "={\n  \"status\": \"error\",\n  \"message\": \"Invalid email address provided. Please use a valid email.\",\n  \"email_checked\": \"{{ $json.parent_email }}\",\n  \"reason\": \"Email verification failed\"\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "13776c5c-32bc-426f-b323-009785b0b4d0",
      "name": "便签 - 错误处理程序",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        592
      ],
      "parameters": {
        "width": 288,
        "height": 472,
        "content": "## ❌ 错误处理程序"
      },
      "typeVersion": 1
    },
    {
      "id": "432c992b-205a-4456-a219-cbf185a09c31",
      "name": "生成同意 ID",
      "type": "n8n-nodes-base.code",
      "position": [
        -96,
        240
      ],
      "parameters": {
        "jsCode": "// Generate unique consent ID with timestamp\nconst consentId = \"CONSENT-\" + Date.now();\nconst timestamp = new Date().toISOString();\nconst formattedDate = new Date().toLocaleDateString('en-IN', {\n  day: '2-digit',\n  month: 'long',\n  year: 'numeric'\n});\n\nreturn [{\n  json: {\n    ...items[0].json,  // Keep all previous data\n    consent_id: consentId,\n    generated_at: timestamp,\n    generated_date: formattedDate\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "3010ab23-55cd-4f78-947a-2660a02910bf",
      "name": "便签 - 生成 ID",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -80
      ],
      "parameters": {
        "width": 340,
        "height": 460,
        "content": "## 🔢 步骤 4: 生成唯一 ID"
      },
      "typeVersion": 1
    },
    {
      "id": "5d456acf-aadc-47bc-a228-de4bbd2eeb85",
      "name": "便签 - HTML 转 PDF",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        64
      ],
      "parameters": {
        "width": 328,
        "height": 324,
        "content": "## 📑 步骤 5: 转换为 PDF"
      },
      "typeVersion": 1
    },
    {
      "id": "81ee82d8-bb11-408c-b41c-b48b9368c180",
      "name": "上传到Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        768,
        240
      ],
      "parameters": {
        "name": "={{ $('Webhook Trigger').item.json.body.child_name .replace(/ /g, '_') }}_{{ $('Generate Consent ID').item.json.consent_id }}.pdf",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_DRIVE_FOLDER_ID",
          "cachedResultUrl": "https://drive.google.com/drive/folders/YOUR_GOOGLE_DRIVE_FOLDER_ID",
          "cachedResultName": "School_Consents"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "YOUR_GOOGLE_DRIVE_OAUTH2_API_ID",
          "name": "Google Drive OAuth2"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "6d7483d8-627d-48fe-a28e-8b0994887568",
      "name": "便签 - Google Drive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -32
      ],
      "parameters": {
        "width": 248,
        "height": 428,
        "content": "## ☁️ 步骤 7: 上传到 Google Drive"
      },
      "typeVersion": 1
    },
    {
      "id": "89f78dcf-6246-4e1f-a59a-31e93296e126",
      "name": "发送 Gmail 给老师",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1056,
        240
      ],
      "webhookId": "YOUR_WEBHOOK_ID",
      "parameters": {
        "sendTo": "={{ $json.teacher_email }}",
        "message": "=Hello Teacher,\n\nA new parent consent form has been verified and securely stored.\n\n📋 CONSENT DETAILS:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n• Consent ID: {{ $('Generate Consent ID').item.json.consent_id }}\n• Child Name: {{ $('Webhook Trigger').item.json.body.child_name }}\n• Class: {{ $('Webhook Trigger').item.json.body.child_class }}\n• Trip Name: {{ $('Webhook Trigger').item.json.body.trip_name }}\n• Trip Date: {{ $('Webhook Trigger').item.json.body.trip_date }}\n• Parent/Guardian: {{ $('Webhook Trigger').item.json.body.parent_name }}\n• Email: {{ $('Webhook Trigger').item.json.body.parent_email }} ✓ (Verified)\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n📁 DOCUMENT LOCATION:\nThe signed PDF consent form is available in Google Drive:\nFolder: School_Consents/2025/November\nFile:{{ $('Webhook Trigger').item.json.body.child_name }} _{{ $('Generate Consent ID').item.json.consent_id }}.pdf\n\n⏰ GENERATED:\n{{ $('Generate Consent ID').item.json.generated_date }}\n{{ $('Generate Consent ID').item.json.generated_at }}\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n🤖 School Automation System\nThis is an automated message. Please do not reply.\n\nFor questions, contact school administration.",
        "options": {},
        "subject": "=New Consent Received: {{ $('Webhook Trigger').item.json.body.child_name }} - {{ $('Webhook Trigger').item.json.body.trip_name }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "YOUR_GMAIL_OAUTH2_API_ID",
          "name": "Gmail OAuth2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "51aedaa7-c489-4d5a-8df7-9c16418aa550",
      "name": "便签 - Gmail 通知",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        0
      ],
      "parameters": {
        "width": 360,
        "height": 396,
        "content": "## 📧 步骤 8: 通知老师"
      },
      "typeVersion": 1
    },
    {
      "id": "adab41f5-05ed-4192-9df3-5f67cf913839",
      "name": "成功响应",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1392,
        240
      ],
      "parameters": {
        "options": {
          "responseCode": 200
        },
        "respondWith": "json",
        "responseBody": "={\n  \"status\": \"success\",\n  \"message\": \"Parent consent form verified and stored successfully\",\n  \"data\": {\n    \"consent_id\": \"{{ $json.consent_id }}\",\n    \"child_name\": \"{{ $json.child_name }}\",\n    \"child_class\": \"{{ $json.child_class }}\",\n    \"trip_name\": \"{{ $json.trip_name }}\",\n    \"trip_date\": \"{{ $json.trip_date }}\",\n    \"parent_name\": \"{{ $json.parent_name }}\",\n    \"parent_email\": \"{{ $json.parent_email }}\",\n    \"email_verified\": true,\n    \"stored_at\": \"Google Drive\",\n    \"teacher_notified\": true,\n    \"generated_at\": \"{{ $json.generated_at }}\"\n  }\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "e269bd4a-4952-4b3b-8ee9-3c6de13ee814",
      "name": "便签 - 成功响应",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        -16
      ],
      "parameters": {
        "width": 360,
        "height": 396,
        "content": "## ✅ 步骤 9: 发送成功响应"
      },
      "typeVersion": 1
    },
    {
      "id": "ff2c31b9-0424-4d95-bb47-866f01653348",
      "name": "Verifi邮箱验证",
      "type": "n8n-nodes-verifiemail.verifiEmail",
      "position": [
        -832,
        432
      ],
      "parameters": {
        "email": "={{ $json.body.parent_email }}"
      },
      "credentials": {
        "verifiEmailApi": {
          "id": "YOUR_VERIFI_EMAIL_API_ID",
          "name": "VerifiEmail API"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "bca1df93-c9d8-4b43-83ed-d4cc367a048c",
      "name": "HTML 转 PDF1",
      "type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf",
      "position": [
        192,
        240
      ],
      "parameters": {
        "html_content": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { \n      font-family: Arial, sans-serif; \n      margin: 0; \n      padding: 20px;\n      background: #f5f5f5;\n    }\n    .container { \n      border: 3px solid #2A3E8D; \n      padding: 40px; \n      max-width: 700px; \n      margin: 0 auto;\n      background: white;\n      box-shadow: 0 4px 6px rgba(0,0,0,0.1);\n    }\n    .header { \n      text-align: center; \n      color: #2A3E8D; \n      border-bottom: 3px solid #2A3E8D;\n      padding-bottom: 20px;\n      margin-bottom: 30px;\n    }\n    .header h1 {\n      margin: 0;\n      font-size: 24px;\n      text-transform: uppercase;\n    }\n    .header p {\n      margin: 10px 0 0 0;\n      font-size: 14px;\n      color: #666;\n    }\n    .consent-id {\n      background: #ffeaa7;\n      padding: 15px;\n      font-weight: bold;\n      text-align: center;\n      margin-bottom: 25px;\n      border: 2px dashed #f39c12;\n      font-size: 16px;\n      letter-spacing: 1px;\n    }\n    .field { \n      margin: 15px 0; \n      padding: 12px;\n      background: #f8f9fa;\n      border-left: 4px solid #2A3E8D;\n    }\n    .label { \n      font-weight: bold; \n      color: #333;\n      display: inline-block;\n      width: 180px;\n    }\n    .value {\n      color: #2A3E8D;\n      font-weight: 600;\n    }\n    .signature-box {\n      margin-top: 50px;\n      padding: 25px;\n      background: #f8f9fa;\n      border: 2px solid #ddd;\n    }\n    .signature-line {\n      border-bottom: 2px solid #000;\n      width: 350px;\n      height: 60px;\n      margin-top: 15px;\n      margin-bottom: 10px;\n    }\n    .footer {\n      margin-top: 40px;\n      font-size: 11px;\n      color: #666;\n      border-top: 2px solid #ddd;\n      padding-top: 20px;\n      text-align: center;\n      line-height: 1.6;\n    }\n    .verified-badge {\n      display: inline-block;\n      background: #00b894;\n      color: white;\n      padding: 3px 10px;\n      border-radius: 12px;\n      font-size: 11px;\n      margin-left: 8px;\n    }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <div class=\"header\">\n      <h1>🏫 OFFICIAL SCHOOL TRIP CONSENT FORM</h1>\n      <p>Academic Year 2025-2026</p>\n    </div>\n    \n    <div class=\"consent-id\">\n      📋 CONSENT ID: {{ $json.consent_id }}\n    </div>\n    \n    <div class=\"field\">\n      <span class=\"label\">Child Name:</span>\n      <span class=\"value\">{{ $('Webhook Trigger').item.json.body.child_name }}</span>\n    </div>\n    \n    <div class=\"field\">\n      <span class=\"label\">Class:</span>\n      <span class=\"value\">{{ $('Webhook Trigger').item.json.body.child_class }}</span>\n    </div>\n    \n    <div class=\"field\">\n      <span class=\"label\">Trip Name:</span>\n      <span class=\"value\">{{ $('Webhook Trigger').item.json.body.trip_name }}</span>\n    </div>\n    \n    <div class=\"field\">\n      <span class=\"label\">Trip Date:</span>\n      <span class=\"value\">{{ $('Webhook Trigger').item.json.body.trip_date }}</span>\n    </div>\n    \n    <div class=\"field\">\n      <span class=\"label\">Parent/Guardian Name:</span>\n      <span class=\"value\">{{ $('Webhook Trigger').item.json.body.parent_name }}</span>\n    </div>\n    \n    <div class=\"field\">\n      <span class=\"label\">Email Address:</span>\n      <span class=\"value\">{{ $('Webhook Trigger').item.json.body.parent_email }}</span>\n      <span class=\"verified-badge\">✓ VERIFIED</span>\n    </div>\n    \n    <div class=\"signature-box\">\n      <p style=\"margin: 0 0 10px 0;\"><strong>I hereby give consent for my child to participate in the above-mentioned school trip.</strong></p>\n      <p style=\"margin: 0 0 20px 0; font-size: 13px; color: #666;\">Parent/Guardian Signature:</p>\n      <div class=\"signature-line\"></div>\n      <p style=\"margin: 5px 0 0 0; font-size: 13px; color: #666;\">Date: {{ $json.generated_date }}</p>\n    </div>\n    \n    <div class=\"footer\">\n      <p><strong>⚠️ OFFICIAL DOCUMENT</strong></p>\n      <p>This is an auto-generated, digitally verified consent document.</p>\n      <p>Generated on: {{ $json.generated_date }} at {{ $json.generated_at }}</p>\n      <p style=\"margin-top: 12px; color: #e74c3c;\">This document is legally binding. Do not share without proper authorization.</p>\n    </div>\n  </div>\n</body>\n</html>"
      },
      "credentials": {
        "htmlcsstopdfApi": {
          "id": "YOUR_HTML_TO_PDF_API_ID",
          "name": "HTML to PDF API"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e26160b3-dd9f-41ab-a49d-9e44caa79661",
      "name": "下载文件",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        528,
        240
      ],
      "parameters": {
        "url": "={{ $json.pdf_url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7dc57259-a438-4967-a494-c993e1e798d7",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        112
      ],
      "parameters": {
        "height": 272,
        "content": "## 下载 PDF"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "HTML to PDF1": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verifi Email": {
      "main": [
        [
          {
            "node": "IF Email Valid",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Upload to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Email Valid": {
      "main": [
        [
          {
            "node": "Generate Consent ID",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Response - Invalid Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Verifi Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Consent ID": {
      "main": [
        [
          {
            "node": "HTML to PDF1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Gmail to Teacher": {
      "main": [
        [
          {
            "node": "Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Google Drive": {
      "main": [
        [
          {
            "node": "Send Gmail to Teacher",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 文档提取

需要付费吗?

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

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

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

作者
Jitesh Dugar

Jitesh Dugar

@jiteshdugar

AI Automation Specialist - OpenAI, CRM & Automation Expert with a solid understanding of various tools that include Zapier, Make, Zoho CRM, Hubspot, Google Sheets, Airtable, Pipedrive, Google Analytics, and more.

外部链接
在 n8n.io 查看

分享此工作流