AutomationFlowsAI & RAG › Generate Exam Question Papers with Gpt-4 and Email Delivery

Generate Exam Question Papers with Gpt-4 and Email Delivery

ByGracewell @gracewellai on n8n.io

This workflow is designed for educators, universities, examination departments, and EdTech institutions that need a faster, smarter, and standardized way to prepare exam question papers.

Event trigger★★★★☆ complexityAI-powered21 nodesForm TriggerOpenAI ChatAgentOutput Parser StructuredGmail
AI & RAG Trigger: Event Nodes: 21 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #9248 — we link there as the canonical source.

This workflow follows the Agent → Form Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "VXI1oimqqgMIuyoW",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Generate Exam Question Papers with GPT-4 and Email Delivery",
  "tags": [
    {
      "id": "FpgsQop46OJZvlVy",
      "name": "email delivery,",
      "createdAt": "2025-10-06T06:19:27.472Z",
      "updatedAt": "2025-10-06T06:19:27.472Z"
    },
    {
      "id": "jOrd4snJb09TgYlm",
      "name": "exam",
      "createdAt": "2025-10-03T18:11:52.921Z",
      "updatedAt": "2025-10-03T18:11:52.921Z"
    },
    {
      "id": "myoUDIKtA36WZV5o",
      "name": "questions",
      "createdAt": "2025-10-03T18:12:03.507Z",
      "updatedAt": "2025-10-03T18:12:03.507Z"
    },
    {
      "id": "sdVZxgD8cvoEmBne",
      "name": "question paper",
      "createdAt": "2025-10-03T18:12:18.509Z",
      "updatedAt": "2025-10-03T18:12:18.509Z"
    }
  ],
  "nodes": [
    {
      "id": "d52fb9c2-2115-4652-8e2e-52dede6bc99e",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -720,
        -500
      ],
      "parameters": {
        "options": {},
        "formTitle": "Syllabus Submission",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Name of the subject with code"
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "syllabus for unit 1"
            },
            {
              "fieldLabel": "syllabus for unit 2"
            },
            {
              "fieldType": "email",
              "fieldLabel": "Enter your email to send the Exam Question Paper.",
              "placeholder": "You will receive the question paper link in the email.",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1747ae55-0145-491d-b06c-7d6fad1b6fb4",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        40,
        -940
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4-turbo-2024-04-09",
          "cachedResultName": "gpt-4-turbo-2024-04-09"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "db8b52b5-de1f-4346-a1e4-a2cd1505bb10",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -20,
        -460
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4-turbo",
          "cachedResultName": "gpt-4-turbo"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c3e9d1d5-46ca-42b4-807e-faa2cbc1c747",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -20,
        100
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "647e3bc6-2672-4858-8cce-f2bc12f2ff4c",
      "name": "Part A QP Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueErrorOutput",
      "position": [
        140,
        -1260
      ],
      "parameters": {
        "text": "=You are a professor in a college assigned to create a question paper.\n\nTask\n\nCreate exactly 4 questions, each worth 13 marks:\n\nQuestions 1 and 2 from {{ $json['syllabus for unit 1'] }}\n\nQuestions 3 and 4 from {{ $json['syllabus for unit 2'] }}\n\nDo NOT include question numbers in the text. Return ONLY valid JSON with 4 items. Generate simple questions with 2 marks each, following Bloom\u2019s Taxonomy levels \u2014 Remember and Understand.\n\nOutput Format\n\n{\n\"QuestionsA\": [\n\"Question from Unit 1 - 1\",\n\"Question from Unit 1 - 2\",\n\"Question from Unit 2 - 1\",\n\"Question from Unit 2 - 2\"\n]\n}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8,
      "alwaysOutputData": false
    },
    {
      "id": "d8336bbc-ad6e-44db-9555-453a4f28de0a",
      "name": "Part C QP Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        180,
        -280
      ],
      "parameters": {
        "text": "=You are a professor in a college assigned to create a question paper for the syllabus.\n\nTask\n\nCreate 2 questions, each worth 14 marks, from the following syllabus: {{ $json['syllabus for unit 1'] }}.\n\nGenerate questions that align with Bloom\u2019s Taxonomy levels \u2014 Analyze and Evaluate.\n\nOutput Format\n\nDisplay each question separately on a new line, one after another.\n\nOutput exactly 2 questions in total.\n\nDo not include question numbers in the output.\n\nReturn the output in valid JSON format as shown below:\n\n{\n  \"QuestionsC\": [\n    \"string (question from Unit 1 - 1)\",\n    \"string (question from Unit 1 - 2)\"\n  ]\n}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "ed68e227-24b1-48d0-879b-5a5db0476399",
      "name": "Structured Output Parser2",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        440,
        60
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\n\t\"QuestionsC\": [\n      \"q1\", \n      \"q2\"\n      ]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "b96123a3-5216-465e-b96f-3b1fdba19821",
      "name": "Structured Output Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        420,
        -440
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"QuestionsB\": [\n    \"string (question from Unit 1)\",\n    \"string (question from Unit 1)\",\n    \"string (question from Unit 2)\",\n    \"string (question from Unit 2)\"\n  ]\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "53df364b-d29e-4bff-a0f3-2a568e27d74e",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        520,
        -860
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"QuestionsA\": [\n    \"Question from Syllabus 1 - 1\",\n    \"Question from Syllabus 1 - 2\",\n    \"Question from Syllabus 2 - 1\",\n    \"Question from Syllabus 2 - 2\"\n  ]\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "710af5bb-3308-49aa-9415-40f89a132aa4",
      "name": "Part B QP Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueRegularOutput",
      "position": [
        120,
        -780
      ],
      "parameters": {
        "text": "=You are a professor in a college assigned to create a question paper.\n\nTask:\n\nCreate exactly 4 questions for Part B, each worth 13 marks.\n\nChoose 2 questions from the following syllabus topics: {{ $json[\"syllabus for unit 1\"] }}\n\nChoose 2 questions from the following syllabus topics: {{ $json[\"syllabus for unit 2\"] }}\n\nGenerate questions worth 13 marks each, following Bloom\u2019s Taxonomy levels \u2014 Apply and Analyse.\n\nOutput Format (must strictly match this schema):\n{\n  \"QuestionsB\": [\n    \"string (question from Unit 1 - 1)\",\n    \"string (question from Unit 1 - 2)\",\n    \"string (question from Unit 2 - 1)\",\n    \"string (question from Unit 2 - 2)\"\n  ]\n}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "7dc94d6b-d214-437c-b6c6-251f231d4053",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "onError": "continueRegularOutput",
      "position": [
        1180,
        -820
      ],
      "parameters": {},
      "typeVersion": 3,
      "alwaysOutputData": true
    },
    {
      "id": "5c40fd23-220c-4215-b6ce-6b9d9c82c88d",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        1440,
        -360
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "feb6ebc0-2a02-45cd-93b6-c273e82a4dd9",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        1620,
        -580
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      QuestionsA: items[0].json.output.QuestionsA,\n      QuestionsB: items[1].json.output.QuestionsB,\n      QuestionsC: items[2].json.output.QuestionsC,\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "11aa55ff-531b-4357-bf9c-208c6939073d",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2100,
        -940
      ],
      "parameters": {
        "sendTo": "={{ $node[\"On form submission\"].json[\"Enter your email to send the Exam Question Paper.\"] }} \n",
        "message": "=Thank you for your interest. We have \n\n{{ $json.html }}",
        "options": {
          "bccList": "user@example.com"
        },
        "subject": "={{ $node[\"On form submission\"].json[\"Name of the subject with code\"] }} Question Paper"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 2.1
    },
    {
      "id": "b92f56f3-0a1a-4dc1-8fda-a73f49cc1047",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1700,
        -1060
      ],
      "parameters": {
        "content": "In the HTML section enter the html code of the question paper template and call the generated question from AI Agents"
      },
      "typeVersion": 1
    },
    {
      "id": "4aaa8af3-6477-4e1b-be7b-dedd9b903870",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2060,
        -1080
      ],
      "parameters": {
        "content": "You will receive the generated question paper in the email."
      },
      "typeVersion": 1
    },
    {
      "id": "972d7487-57a9-48d4-9ff2-2580721d38b7",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -840,
        -660
      ],
      "parameters": {
        "content": "In the form, input the subject code/name, syllabus, and email to send the question paper      "
      },
      "typeVersion": 1
    },
    {
      "id": "00b1703f-2de1-4b68-b395-990731953778",
      "name": "QP Formatter with HTML",
      "type": "n8n-nodes-base.html",
      "position": [
        1780,
        -920
      ],
      "parameters": {
        "html": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Question Paper</title>\n    <style>\n        body {\n            font-family: 'Times New Roman', Times, serif;\n            margin: 40px;\n            line-height: 1.6;\n        }\n        .header {\n            text-align: center;\n            border-bottom: 2px solid #000;\n            padding-bottom: 10px;\n            margin-bottom: 20px;\n        }\n        .header img {\n            width: 120px;\n            vertical-align: middle;\n        }\n        .header h1, .header h2, .header h3 {\n            margin: 5px 0;\n        }\n        .title-section {\n            text-align: center;\n            margin-bottom: 30px;\n        }\n        .part-title {\n            font-weight: bold;\n            margin-top: 25px;\n            font-size: 18px;\n        }\n        .question {\n            margin: 10px 0;   /* removed left margin */\n        }\n        .sub-question {\n            margin: 5px 0;   /* removed left margin */\n        }\n        .footer {\n            margin-top: 40px;\n            font-size: 12px;\n            text-align: center;\n            border-top: 1px solid #000;\n            padding-top: 10px;\n        }\n    </style>\n</head>\n<body>\n\n    <!-- Header -->\n    <div class=\"header\">\n        <h1>AI-AGENT LEARNING AND TRAINING COLLEGE</h1>\n        <h3>Autonomous | Approved by AIXYZ | Affiliated to XYZ University</h3>\n        <h3>College Code: XYZ123</h3>\n    </div>\n\n    <!-- Title Section -->\n    <div class=\"title-section\">\n        <h2>Assessment QP \u2013 Month \u2013 Year (for III, V and VII Sem)</h2>\n        <p><strong>Sub. Code/Name:</strong> 24YSN2025 - {{ $node['On form submission'].json['Name of the subject with code'] }} </p>\n        <p><strong>Slot/Strength:</strong> 25FLrn / NN Students</p>\n    </div>\n\n    <!-- Part A -->\n    <div>\n        <div class=\"part-title\" style=\"text-align: center;\">PART \u2013 A (4 x 2 = 08 Marks)</div>\n        <p><strong>1.</strong> {{ $json.QuestionsA[0] }}</p>\n        <p><strong>2.</strong> {{ $json.QuestionsA[1] }}</p>\n        <p><strong>3.</strong> {{ $json.QuestionsA[2] }}</p>\n        <p><strong>4.</strong> {{ $json.QuestionsA[3] }}</p>\n    </div>\n\n    <!-- Part B -->\n    <div>\n        <div class=\"part-title\" style=\"text-align: center;\">PART \u2013 B (2 x 13 = 26 Marks)</div>\n\n        <p class=\"question\"><strong>3a.</strong> {{ $json.QuestionsB[0] }}</p>\n        <p style=\"text-align: center; font-weight: bold; margin: 5px 0;\">or</p>\n        <p class=\"question\"><strong>3b.</strong> {{ $json.QuestionsB[1] }}</p>\n\n        <p class=\"question\"><strong>4a.</strong> {{ $json.QuestionsB[2] }}</p>\n        <p style=\"text-align: center; font-weight: bold; margin: 5px 0;\">or</p>\n        <p class=\"question\"><strong>4b.</strong> {{ $json.QuestionsB[3] }}</p>\n    </div>\n\n    <!-- Part C -->\n    <div>\n        <div class=\"part-title\" style=\"text-align: center;\">PART \u2013 C (Case Study / Applications) (1 x 14 = 14 Marks)</div>\n        <p class=\"sub-question\"><strong>5a.</strong> {{ $json.QuestionsC[0] }}</p>\n        <p style=\"text-align: center; font-weight: bold; margin: 5px 0;\">or</p>\n        <p class=\"sub-question\"><strong>5b.</strong> {{ $json.QuestionsC[1] }}</p>\n    </div>\n\n    <!-- Footer -->\n    <div class=\"footer\">\n        Generated on: {{ new Date().toLocaleDateString(\"en-GB\") }} template by Gracewell89 via N8N\n    </div>\n\n</body>\n</html>\n"
      },
      "typeVersion": 1.2,
      "alwaysOutputData": false
    },
    {
      "id": "261c711f-af63-4362-bfff-39897a4e7438",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        540,
        -1320
      ],
      "parameters": {
        "content": "This AI Agent will generate four 2 mark questions "
      },
      "typeVersion": 1
    },
    {
      "id": "c706be51-1c6a-4c45-9b31-6dd52a24aaf7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        -720
      ],
      "parameters": {
        "content": "This AI Agent will generate four 13 mark questions with each question having 2 choices"
      },
      "typeVersion": 1
    },
    {
      "id": "791adcb1-058e-4a5b-a4c5-711d4c0fd61d",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        -180
      ],
      "parameters": {
        "content": "This AI Agent will generate two 14 mark questions with each question having 2 choices"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1"
  },
  "versionId": "d01a99dd-8100-4e2a-b097-d897b44af582",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "QP Formatter with HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Part A QP Agent": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Part C QP Agent": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Part B QP Agent1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Part A QP Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Part A QP Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "Part C QP Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "Part B QP Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Part B QP Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Part C QP Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "QP Formatter with HTML": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Part A QP Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Part B QP Agent1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser2": {
      "ai_outputParser": [
        [
          {
            "node": "Part C QP Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow is designed for educators, universities, examination departments, and EdTech institutions that need a faster, smarter, and standardized way to prepare exam question papers.

Source: https://n8n.io/workflows/9248/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow automates end-to-end contract and invoice management using AI intelligence. It processes proposals through intelligent contract generation, approval workflows, and automated invoicing. O

Form Trigger, Data Table, Agent +4
AI & RAG

This n8n workflow template automates your lead generation and follow-up process using AI. It captures leads through a form, enriches them with company data, classifies them into different categories,

Gmail, Output Parser Structured, Form Trigger +5
AI & RAG

Automates SaaS operations by consolidating user management, AI-driven support triage, analytics, and billing into one unified system. User signups flow through registration, support requests route via

Form Trigger, Data Table, Agent +7
AI & RAG

The workflow runs every hour with a randomized delay of 5–20 minutes to help distribute load. It records the exact date and time a lead is emailed so you can track outreach. Follow-ups are automatical

Google Sheets, Agent, OpenAI Chat +5
AI & RAG

This workflow automatically analyzes a website for UX and SEO quality. It uses Airtop for realistic web scraping, OpenAI for structured evaluation of metadata (title, description, and overall SEO sign

Airtop Tool, Form Trigger, OpenAI Chat +6