See llms.txt for all machine-readable content.

Back to Templates

Generate secure worksheets and password-protected answer keys with OpenAI and Gmail

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

  1. Receives a submission from an n8n Form with the teacher email, grade level, topic, and a secret password.
  2. Uses OpenAI to generate a five-question student worksheet as raw HTML with blank spaces for answers.
  3. Converts the worksheet HTML into a PDF using HTMLCSS to PDF and captures a shareable PDF URL.
  4. Uses OpenAI to rewrite the same worksheet as an ANSWER KEY HTML document with correct answers added in bold red text.
  5. Converts the answer-key HTML to a PDF using HTMLCSS to PDF.
  6. Password-protects the answer-key PDF using the secret password from the form.
  7. Sends a Gmail message to the teacher with the worksheet link in the email body and the locked answer key attached.

Setup

  1. Add an OpenAI API credential for the two OpenAI steps.
  2. Add an HTMLCSS to PDF (htmlcsstopdf) API credential to generate PDFs and apply PDF security.
  3. Add a Gmail OAuth2 credential and confirm the sender mailbox used to email the materials.
  4. 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.