Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Sorting website form enquiries with an LLM that can only answer from a list

Description and use

A compact n8n workflow uses an LLM to classify contact‑form enquiries into a fixed set of categories, logging results in Google Sheets and flagging any non‑exact matches for human review.

Problem

Contact forms generate varied enquiries that must be categorized; free‑form LLM responses cause inconsistent categories and break spreadsheet filters.

Outcome

The workflow correctly logs 17 test cases, handling valid categories, nulls, invented IDs, sentences, HTTP 500 errors, braces in text, and invalid emails, ensuring each valid request produces exactly one row and no external hosts are contacted.

Workflow

  • Receive form POST via webhook (name, email, company, message).
  • Normalize data; if email invalid, return HTTP 400 and abort.
  • Send to LLM a prompt containing the list of category IDs and the enquiry text.
  • Receive LLM reply; trim, lowercase, strip quotes and trailing period.
  • Check if reply exactly matches one of the predefined IDs.
  • If match, write row to Google Sheets with category; if not, write row with needs_human flag and check_notes.
  • Return HTTP 200 with the category to the form webhook.

Evidence

So I built a small n8n workflow where the model gets a fixed list of category ids and may answer with one of them or null.

Source

The model's reply gets trimmed, lowercased, and stripped of quotes and a trailing full stop.

Source

I ran it on a real n8n 1.123.87 instance with local stand‑ins for the OpenAI and Google Sheets APIs, and 17 checks passed: correct categories logged for sales and support enquiries...

Source

  • Record date: 2026-11-01T05:13:43.225Z