8
n8n 中文网amn8n.com

n8n联系表单工作流

中级

这是一个Support领域的自动化工作流,包含 13 个节点。主要使用 If, Form, EmailSend, FormTrigger 等节点。 n8n联系表单工作流

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "7d8066d2f56a07000fe7d753d3eeabf0ecdf68413466f30d10afe0906f058427",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ae78f14b-8e88-40ca-a5f3-39344aee3ea7",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -560,
        -60
      ],
      "webhookId": "ea054497-a16c-4ff3-85a5-0661a816f0fe",
      "parameters": {
        "options": {
          "path": "contact-us",
          "ignoreBots": false,
          "buttonLabel": "Submit",
          "appendAttribution": false,
          "useWorkflowTimezone": true
        },
        "formTitle": "Contact Us",
        "formFields": {
          "values": [
            {
              "fieldLabel": "First Name",
              "placeholder": "eg: John",
              "requiredField": true
            },
            {
              "fieldLabel": "Last Name",
              "placeholder": "eg: Doe",
              "requiredField": true
            },
            {
              "fieldType": "email",
              "fieldLabel": "Email",
              "placeholder": "eg: johndoe@gmail.com",
              "requiredField": true
            },
            {
              "fieldLabel": "Company",
              "placeholder": "eg: Apple Inc"
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Message",
              "placeholder": "Type your message here ...",
              "requiredField": true
            }
          ]
        },
        "formDescription": "We'll get back to you soon."
      },
      "typeVersion": 2.2
    },
    {
      "id": "ae23881c-6084-4392-8c7c-16058839345c",
      "name": "重定向表单",
      "type": "n8n-nodes-base.form",
      "position": [
        320,
        -160
      ],
      "webhookId": "b644aa17-b0f2-4fe8-952c-bf166eeaa9aa",
      "parameters": {
        "operation": "completion",
        "redirectUrl": "https://www.linkedin.com/in/akhilv7/",
        "respondWith": "redirect"
      },
      "typeVersion": 1
    },
    {
      "id": "807425c4-f058-4e94-82bd-72e856c4e27c",
      "name": "确认表单",
      "type": "n8n-nodes-base.form",
      "position": [
        100,
        -160
      ],
      "webhookId": "d9d1c645-c2ed-48fa-b3d7-cbb9c76669bb",
      "parameters": {
        "options": {
          "formTitle": "✅ Thank You!",
          "buttonLabel": "Redirect to Home"
        },
        "formFields": {
          "values": [
            {
              "html": "<html>\n<head>\n  <meta charset=\"UTF-8\">\n</head>\n<body style=\"margin:0;padding:0;background:linear-gradient(135deg,#e0f7ec,#f0fff5);height:100vh;display:flex;justify-content:center;align-items:center;\">\n  <div style=\"background:#fff;border:1px solid #d1e7dd;border-radius:12px;padding:50px 60px;box-shadow:0 6px 20px rgba(0,0,0,0.1);text-align:center;\">\n    <div style=\"font-size:20px;color:#333;\">\n      Your message has been received. We’ll get back to you shortly.\n    </div>\n  </div>\n</body>\n</html>\n",
              "fieldType": "html"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b5a85199-8398-4a11-9c4a-82c27385e531",
      "name": "如果邮件已发送",
      "type": "n8n-nodes-base.if",
      "position": [
        -120,
        -60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "910ddd40-a124-4826-987b-5c6aef997a7a",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.messageId }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "9d7387fa-b861-45f7-897f-a985d5e07cac",
      "name": "发送邮件给支持",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -340,
        -60
      ],
      "webhookId": "52224f95-e14f-4b8f-8daa-601aac17b914",
      "parameters": {
        "html": "=<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <title>New Contact Submission</title>\n  </head>\n  <body\n    style=\"\n      margin: 0;\n      padding: 0;\n      background-color: #f4f6f8;\n      font-family: Arial, sans-serif;\n    \"\n  >\n    <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"padding: 20px\">\n      <tr>\n        <td align=\"center\">\n          <table\n            width=\"600\"\n            cellpadding=\"0\"\n            cellspacing=\"0\"\n            style=\"\n              background-color: #ffffff;\n              border: 1px solid #e0e0e0;\n              border-radius: 8px;\n              box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);\n              padding: 30px;\n            \"\n          >\n            <tr>\n              <td\n                style=\"\n                  text-align: center;\n                  font-size: 22px;\n                  font-weight: bold;\n                  color: #333333;\n                  padding-bottom: 20px;\n                \"\n              >\n                📬 New Contact Submission\n              </td>\n            </tr>\n\n            <tr>\n              <td style=\"border-top: 1px solid #eaeaea; padding-top: 20px\"></td>\n            </tr>\n\n            <tr>\n              <td style=\"font-size: 16px; color: #333; padding: 10px 0\">\n                <strong>First Name:</strong> {{ $json['First Name'] }}\n              </td>\n            </tr>\n\n            <tr>\n              <td\n                style=\"\n                  font-size: 16px;\n                  color: #333;\n                  padding: 10px 0;\n                  border-top: 1px solid #f0f0f0;\n                \"\n              >\n                <strong>Last Name:</strong> {{ $json['Last Name'] }}\n              </td>\n            </tr>\n\n            <tr>\n              <td\n                style=\"\n                  font-size: 16px;\n                  color: #333;\n                  padding: 10px 0;\n                  border-top: 1px solid #f0f0f0;\n                \"\n              >\n                <strong>Email:</strong> {{ $json.Company }}\n              </td>\n            </tr>\n\n            <tr>\n              <td\n                style=\"\n                  font-size: 16px;\n                  color: #333;\n                  padding: 10px 0;\n                  border-top: 1px solid #f0f0f0;\n                \"\n              >\n                <strong>Company:</strong> {{ $json.Company }}\n              </td>\n            </tr>\n\n            <tr>\n              <td\n                style=\"\n                  font-size: 16px;\n                  color: #333;\n                  padding: 10px 0;\n                  border-top: 1px solid #f0f0f0;\n                \"\n              >\n                <strong>Message:</strong>\n                <div\n                  style=\"\n                    margin-top: 8px;\n                    padding: 12px;\n                    background: #f9fafb;\n                    border-left: 4px solid #28a745;\n                    border-radius: 4px;\n                    color: #555;\n                  \"\n                >\n                  {{ $json.Message }}\n                </div>\n              </td>\n            </tr>\n\n            <tr>\n              <td\n                style=\"\n                  font-size: 12px;\n                  color: #999;\n                  text-align: center;\n                  padding-top: 30px;\n                  border-top: 1px solid #eaeaea;\n                \"\n              >\n                This message was submitted via the contact form on your website.\n              </td>\n            </tr>\n          </table>\n        </td>\n      </tr>\n    </table>\n  </body>\n</html>\n",
        "options": {
          "appendAttribution": false
        },
        "subject": "=🔔 New Contact Form Submission from {{ $json['First Name'] }} {{ $json['Last Name'] }}",
        "toEmail": "akhilgadiraju@email.com",
        "fromEmail": "notifications@your-domain.com"
      },
      "credentials": {
        "smtp": {
          "id": "vCexcphurglwGBfk",
          "name": "SMTP account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c6feba50-13b0-46db-9349-e57ae8f758db",
      "name": "表单",
      "type": "n8n-nodes-base.form",
      "position": [
        100,
        40
      ],
      "webhookId": "c4900b17-ea10-4c30-ab06-c5625ac450b0",
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Oops! Something Went Wrong",
        "completionMessage": "We couldn’t process your submission. Please try again later."
      },
      "typeVersion": 1
    },
    {
      "id": "6822eb0f-e6d0-4e47-9779-b02e6c6c0b9e",
      "name": "结束(成功)",
      "type": "n8n-nodes-base.noOp",
      "position": [
        540,
        -160
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3b5cdccd-0f8f-474e-9297-a6952f9b403a",
      "name": "结束(错误)",
      "type": "n8n-nodes-base.noOp",
      "position": [
        320,
        40
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "33928014-6602-4396-ab65-df189a1787fb",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -620,
        -180
      ],
      "parameters": {
        "height": 100,
        "content": "### 自定义字段"
      },
      "typeVersion": 1
    },
    {
      "id": "8eb0b887-1fb0-4f76-975a-8b9acb1d296c",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        100
      ],
      "parameters": {
        "color": 4,
        "height": 80,
        "content": "### 自定义邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "20b3562d-6ebd-4b68-80ee-ceeaf66887b3",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -260
      ],
      "parameters": {
        "width": 260,
        "height": 80,
        "content": "### 自定义消息内容"
      },
      "typeVersion": 1
    },
    {
      "id": "5becd350-ac1b-4f5b-b213-975bccbb1455",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        280,
        -260
      ],
      "parameters": {
        "height": 80,
        "content": "### 更改重定向 URL"
      },
      "typeVersion": 1
    },
    {
      "id": "4b570ac9-606c-452c-b640-582f4758bfcc",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        200
      ],
      "parameters": {
        "width": 280,
        "height": 100,
        "content": "### 更改消息"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Form": {
      "main": [
        [
          {
            "node": "End (Error)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Email Sent": {
      "main": [
        [
          {
            "node": "Confirmation Form",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redirect Form": {
      "main": [
        [
          {
            "node": "End (Success)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Confirmation Form": {
      "main": [
        [
          {
            "node": "Redirect Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Send Email to Support",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email to Support": {
      "main": [
        [
          {
            "node": "If Email Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 客户支持

需要付费吗?

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

工作流信息
难度等级
中级
节点数量13
分类1
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
外部链接
在 n8n.io 查看

分享此工作流