8
n8n 中文网amn8n.com

使用Jotform和Gemini AI生成个性化和汇总调查报告

高级

这是一个自动化工作流,包含 18 个节点。主要使用 Set, Code, Wait, Gmail, SplitOut 等节点。 使用Jotform和Gemini AI生成个性化和汇总调查报告

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "02059f0cb4b0ce23b903e8adf7a801dac35cd440dae5af845bde6649af1dcbcf",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "7e0aa177-12cf-4a1c-a035-2a5aaf460bff",
      "name": "表单提交触发器",
      "type": "n8n-nodes-base.jotFormTrigger",
      "position": [
        7936,
        5072
      ],
      "webhookId": "YOUR_WEBHOOK_ID_FORM_SUBMISSION_TRIGGER",
      "parameters": {
        "form": "YOUR_JOTFORM_FORM_ID"
      },
      "typeVersion": 1
    },
    {
      "id": "ea0090ca-7a4d-481c-b3ad-469d70fa292e",
      "name": "收集个人回复",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        8144,
        5072
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "9bd60900-84a2-400d-8fb7-09b7ce7600bf",
      "name": "生成个人报告",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        8352,
        5072
      ],
      "parameters": {
        "text": "=Analyze this survey response and generate a concise personalized report.\n\ntodays date :- {{ $now }}\n\nRESPONDENT DATA:\n{{ $json.data.toJsonString() }}\n\nINSTRUCTIONS:\n1. Extract: Age, Gender, Employment, Email\n2. Analyze responses and identify 3-4 key insights\n3. Generate 3-4 specific recommendations\n4. Create compact HTML report with:\n   - Professional header with gradient background\n   - Recipient info section\n   - Key Insights section with styled bullets\n   - Recommendations section with styled bullets\n   - Modern, clean design with good spacing\n   - Professional color scheme\n   - Footer with thank you message\n\nSTYLING REQUIREMENTS:\n- Use modern, professional colors (blues, grays)\n- Clear typography with good hierarchy\n- Proper spacing and padding\n- Rounded corners on sections\n- Subtle borders and shadows\n- Mobile-responsive design\n- Easy-to-scan format with visual hierarchy\n\nRETURN JSON ONLY:\n{\n  \"email_subject\": \"string\",\n  \"html_report\": \"string\"\n}",
        "options": {
          "systemMessage": "You are a concise survey analysis system that generates brief, point-by-point personalized reports.\n\nYour role:\n1. Extract key facts from survey responses\n2. Identify 3-4 main insights specific to the respondent\n3. Generate 3-4 actionable recommendations\n4. Create a compact HTML email report (minimal design, quick read)\n\nGuidelines:\n- Be concise and direct - no lengthy explanations\n- Use bullet points and short statements\n- Focus on: demographics, consumption habits, spending, health, brand preference\n- Generate specific recommendations based on their answers\n- Maintain professional tone\n- Ensure HTML is compact and email-friendly\n\nOutput ONLY valid JSON with no additional text."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "dae0887f-fe3e-4967-a3fa-29878f03aa07",
      "name": "响应就绪 - 暂停",
      "type": "n8n-nodes-base.wait",
      "position": [
        8704,
        5072
      ],
      "webhookId": "YOUR_WEBHOOK_ID_RESPONSE_READY_-_PAUSE",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "a0c4f4ff-a078-46d3-844e-30bd662a383f",
      "name": "Gemini LLM(个人)",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        8304,
        5264
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "3c885d88-083c-4a60-8ef0-1b73af282d6e",
      "name": "解析个人报告JSON",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        8528,
        5280
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"email_subject\": \"Your Fast Food Survey Analysis - Key Insights\",\n  \"html_report\": \"[Complete personalized HTML report with inline CSS]\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "03432b73-c45f-4431-94e4-6c1b050f36fc",
      "name": "发送个人报告",
      "type": "n8n-nodes-base.gmail",
      "position": [
        8912,
        5072
      ],
      "webhookId": "YOUR_WEBHOOK_ID_SEND_PERSONAL_REPORT",
      "parameters": {
        "sendTo": "={{ $('Form Submission Trigger').item.json['Please indicate your email so that we can reach you about the results.'] }}",
        "message": "={{ $json.output.html_report }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $json.output.email_subject }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "340a9911-23d4-4cd3-abc4-c4bfdf6a7f20",
      "name": "Gemini LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        8880,
        5856
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a0b2076e-742b-4e9f-be8f-a8b144b7ff7b",
      "name": "周报调度器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        7696,
        5680
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtHour": 11
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "88f3cdd7-57c0-41e4-b04a-8d9ed0a40c77",
      "name": "获取调查提交",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        7920,
        5680
      ],
      "parameters": {
        "url": "https://api.jotform.com/form/YOUR_JOTFORM_FORM_ID/submissions",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "apiKey",
              "value": "YOUR_JOTFORM_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a03fc700-9c02-4bff-9e8a-1dc32d465acd",
      "name": "解包响应对象",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        8128,
        5680
      ],
      "parameters": {
        "include": "selectedOtherFields",
        "options": {},
        "fieldToSplitOut": "content",
        "fieldsToInclude": "content.id, content.answers"
      },
      "typeVersion": 1
    },
    {
      "id": "e01bacda-db4d-42de-b069-e0f1757a7dd9",
      "name": "规范化响应字段",
      "type": "n8n-nodes-base.set",
      "position": [
        8320,
        5680
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f027e797-014e-47d9-ad55-0036bd06a453",
              "name": "content.id",
              "type": "string",
              "value": "={{ $json.content.id }}"
            },
            {
              "id": "43730158-8ed8-4abc-9a8a-cd62846a98bf",
              "name": "",
              "type": "string",
              "value": ""
            },
            {
              "id": "f5063b4f-ab7a-4007-9bb2-24fafbbdb78f",
              "name": "content.answers",
              "type": "object",
              "value": "={{ $json.content.answers }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d56e17da-0499-4361-884d-875ca9d2822e",
      "name": "提取问答对",
      "type": "n8n-nodes-base.code",
      "position": [
        8528,
        5680
      ],
      "parameters": {
        "jsCode": "// Extract id, text, and answer from each submission\nconst results = [];\n\nfor (const item of $input.all()) {\n  const submission = item.json.content;\n  const id = submission.id;\n  const answers = submission.answers;\n  \n  // Extract only questions with answers (exclude headers, buttons, and empty answers)\n  const extractedAnswers = [];\n  \n  for (const key in answers) {\n    const field = answers[key];\n    \n    // Only include if it has text and answer, and is not a control element\n    if (field.text && field.answer && field.type !== 'control_head' && field.type !== 'control_button') {\n      extractedAnswers.push({\n        text: field.text,\n        answer: field.answer\n      });\n    }\n  }\n  \n  results.push({\n    id: id,\n    survey_responses: extractedAnswers\n  });\n}\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "da49efb8-fbb7-4b0e-8d1f-359fa85601a4",
      "name": "合并所有响应",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        8720,
        5680
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "157b8677-aa4d-4068-80f8-e2389073984a",
      "name": "分析与报告",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        8928,
        5680
      ],
      "parameters": {
        "text": "=Generate an aggregate report from these survey submissions.\n\nSURVEY DATA:\n{{ $json.data.toJsonString() }}\n\nReturn ONLY valid JSON with these exact two fields:\n{\n  \"email_subject\": \"Survey Aggregate Report - 4 Respondents - Fast Food Consumption Study\",\n  \"html_report\": \"[Complete HTML with inline styles, professional design, all statistics, demographics, insights, and findings embedded in the HTML string]\"\n}\n\nDo not include any text, markdown, or explanations outside the JSON.",
        "options": {
          "systemMessage": "=You are a survey aggregation and statistical analysis system that generates professional HTML reports from multiple survey submissions.\n\nYour ONLY job is to return a JSON object with exactly two fields:\n1. email_subject: A string with the report title\n2. html_report: A string containing complete, valid HTML with inline CSS\n\nDo NOT include any text before or after the JSON. Do NOT include markdown backticks. Do NOT include explanations.\n\nProcess:\n- Count total respondents\n- Analyze each question's responses\n- Calculate percentages and frequencies\n- Identify demographic patterns\n- Generate 5-7 key insights\n- Create comprehensive HTML report with statistics\n\nReturn ONLY this JSON structure:\n{\n  \"email_subject\": \"string\",\n  \"html_report\": \"string\"\n}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "999ae35e-9a91-4a69-af48-8a4b52390eb9",
      "name": "发送报告给管理员",
      "type": "n8n-nodes-base.gmail",
      "position": [
        9264,
        5680
      ],
      "webhookId": "YOUR_WEBHOOK_ID_SEND_REPORT_TO_ADMIN",
      "parameters": {
        "sendTo": "=YOUR_ADMIN_EMAIL@example.com",
        "message": "={{ $json.output.html_report }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $json.output.email_subject }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "f38a7b8f-ed90-417c-9956-c67787ff3cc7",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        9088,
        5872
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"email_subject\": \"Your Fast Food Survey Analysis - Key Insights\",\n  \"html_report\": \"[Complete personalized HTML report with inline CSS]\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "27544677-1438-444f-b90d-6b494daa02cd",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7168,
        4992
      ],
      "parameters": {
        "width": 2368,
        "height": 1040,
        "content": "# 通过Jotform实现自动化调查报告"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Gemini LLM": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze & Report",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Analyze & Report": {
      "main": [
        [
          {
            "node": "Send Report to Admin",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Q&A Pairs": {
      "main": [
        [
          {
            "node": "Merge All Responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge All Responses": {
      "main": [
        [
          {
            "node": "Analyze & Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini LLM (Personal)": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Personal Report",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Response Ready - Pause": {
      "main": [
        [
          {
            "node": "Send Personal Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Form Submission Trigger": {
      "main": [
        [
          {
            "node": "Collect Individual Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unpack Response Objects": {
      "main": [
        [
          {
            "node": "Normalize Response Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Report Scheduler": {
      "main": [
        [
          {
            "node": "Fetch Survey Submissions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Survey Submissions": {
      "main": [
        [
          {
            "node": "Unpack Response Objects",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Personal Report": {
      "main": [
        [
          {
            "node": "Response Ready - Pause",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze & Report",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Response Fields": {
      "main": [
        [
          {
            "node": "Extract Q&A Pairs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Personal Report JSON": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Personal Report",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Collect Individual Response": {
      "main": [
        [
          {
            "node": "Generate Personal Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级

需要付费吗?

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

工作流信息
难度等级
高级
节点数量18
分类-
节点类型13
难度说明

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

作者
Roshan Ramani

Roshan Ramani

@rawsun007

I love building smart n8n automations that actually work reliably. My focus is on making everyday tasks like email, social media, and CRM workflows simpler using AI. I've shared templates in the n8n community, including a WhatsApp Expense Tracker that people really enjoy. What keeps me excited is constantly trying new things - testing fresh nodes, playing with AI tools like LangChain, and discovering creative ways to connect systems!

外部链接
在 n8n.io 查看

分享此工作流