Generate structured exams from PDFs with OpenAI GPT-4o and HTML to PDF

Go to Workflow
2 views
Built by Ramdoni Ramdoni
Created on June 13, 2026

Description

๐Ÿš€ ExamForge AI
Automated PDF to Structured Exam Generator (MCQ + Essay + Answer Key)

Generate structured exams automatically from text-based PDF materials using AI.

ExamForge AI is a production-ready n8n workflow that transforms educational content into multiple-choice and essay questions with customizable difficulty and automatic answer key generation.

โœจ Features

๐Ÿ“„ Upload PDF via Webhook
โœ… File size validation (default: max 5MB)
๐Ÿงน Automatic text cleaning
๐Ÿ“ Token length estimation & safety control
๐ŸŽฏ Customizable MCQ & Essay count
๐Ÿง  Difficulty selection (easy / medium / hard)
๐ŸŒ Language selection
๐Ÿ“ฆ Structured JSON AI output
๐Ÿ“ Separate Exam PDF & Answer Key PDF
๐Ÿ“ฒ Telegram delivery support (optional)
๐Ÿ”’ Parameter validation with structured error responses

๐Ÿง  What This Workflow Does

Accepts PDF upload via Webhook
Validates file size
Extracts and cleans text content
Estimates text length to prevent token overflow
Validates required parameters:
mcq_count
essay_count
difficulty
language
Sends structured prompt to OpenAI
Parses JSON response
Formats exam and answer key separately
Converts both into PDF
Sends results via Telegram or Webhook response

โš™๏ธ Requirements

Accounts Required

OpenAI account (API key required)
Telegram Bot (optional)
PDF Munk (API key required)

Environment

n8n (self-hosted or cloud)
Node version compatible with your n8n installation

๐Ÿ”‘ Credentials Setup

1๏ธโƒฃ OpenAI

Add OpenAI credentials inside n8n
Insert your API key
Select preferred model (e.g., GPT-4o / GPT-4)

2๏ธโƒฃ Telegram (Optional)

Create a Telegram Bot via BotFather
Insert Bot Token into Telegram node
Add your Chat ID

๐Ÿ›  Webhook Configuration

Method: POST
Content-Type: multipart/form-data

Required Parameters

| Parameter | Type | Required | Description |
|--------------|--------|----------|-------------|
| file | File | Yes | PDF document |
| mcq_count | Number | Yes | Number of multiple-choice questions |
| essay_count | Number | Yes | Number of essay questions |
| difficulty | String | Yes | easy / medium / hard |
| language | String | Yes | Output language |

๐Ÿ“ฅ Example Request

curl -X POST https://your-n8n-domain/webhook/examforge \
-F "[email protected]" \
-F "mcq_count=20" \
-F "essay_count=5" \
-F "difficulty=medium" \
-F "language=Indonesian"

Nodes Used (3)

Code
n8n-nodes-base.code
OpenAI
@n8n/n8n-nodes-langchain.openAi
Telegram
n8n-nodes-base.telegram