Quick overview
This workflow collects lesson details via an n8n form, uses OpenAI to generate a student worksheet and matching answer key, converts both to PDFs with HTMLCSS to PDF, password-locks the answer key, and emails the worksheet link plus the protected PDF via Gmail.
How it works
- Receives a submission from an n8n Form with the teacher email, grade level, topic, and a secret password.
- Uses OpenAI to generate a five-question student worksheet as raw HTML with blank spaces for answers.
- Converts the worksheet HTML into a PDF using HTMLCSS to PDF and captures a shareable PDF URL.
- Uses OpenAI to rewrite the same worksheet as an ANSWER KEY HTML document with correct answers added in bold red text.
- Converts the answer-key HTML to a PDF using HTMLCSS to PDF.
- Password-protects the answer-key PDF using the secret password from the form.
- Sends a Gmail message to the teacher with the worksheet link in the email body and the locked answer key attached.
Setup
- Add an OpenAI API credential for the two OpenAI steps.
- Add an HTMLCSS to PDF (htmlcsstopdf) API credential to generate PDFs and apply PDF security.
- Add a Gmail OAuth2 credential and confirm the sender mailbox used to email the materials.
- Publish the n8n Form and share its URL with teachers so they can submit the required inputs, including the password used to open the answer key.