See llms.txt for all machine-readable content.

Back to Templates

Triage website contact form inquiries with OpenAI, SMTP, Telegram and Sheets

Quick overview

This workflow receives website contact form submissions via a webhook, filters bots with a honeypot, uses OpenAI to classify the inquiry and flag urgency, then sends an SMTP confirmation email (when valid), notifies your team in Telegram, and logs every request to Google Sheets.

How it works

  1. Receives a POST request from your website contact form via an n8n webhook.
  2. Normalizes the incoming fields and drops requests where the hidden honeypot field (website) is filled.
  3. Sends the message text to OpenAI to classify it as appointment, quote, complaint, or other and mark it as urgent or not.
  4. Validates and constrains the AI output, checks whether the sender email address looks valid, and escapes/sanitizes content for safe HTML and Google Sheets logging.
  5. Sends a confirmation email to the sender via SMTP only when the email address passes validation.
  6. Sends a formatted Telegram message to your team and appends the inquiry details as a new row in Google Sheets.

Setup

  1. Add credentials for OpenAI, your SMTP email account, Telegram, and Google Sheets in n8n.
  2. Create a Google Sheet with columns for date, name, email, type, urgent, and message, then select the document and sheet in the Google Sheets node.
  3. Update the email sender address (fromEmail) in the SMTP email node and set your Telegram chat ID in the Telegram node.
  4. Point your website form to the webhook URL and ensure it posts the fields name, email, message, source, and website (with website as a hidden honeypot field that stays empty).

Requirements

  • OpenAI account (model gpt-4o-mini by default)
  • SMTP account (confirmation email)
  • Telegram bot (team notification)
  • Google Sheets account (inquiry log)
  • No community nodes
  • Testing: Tested end to end on a self-hosted n8n with the webhook, filter, Code and email/Telegram/Sheets steps stubbed, and with real OpenAI and Telegram nodes. The SMTP and Google Sheets nodes were not run against live services.

Customization

  • Edit the system prompt in the Classify inquiry node for your trade and categories.
  • The confirmation email is English with a fixed greeting that contains no form text. Replace the text with your language.
  • Add a CRM node after the Parse and validate node.
  • Keep the hidden form field website empty: it is the bot trap.

Additional info

Limits and risks

  • The webhook is public. The template has no rate limit and no captcha. Put both in front of n8n (reverse proxy or form provider). Without them, anyone can trigger confirmation emails to other people's addresses.
  • Form text goes to the AI model. The prompt tells the model to treat the text as data. This reduces prompt injection but does not rule it out. The Code node accepts only the allowed values.
  • Mail and Telegram nodes continue on error. A failed SMTP login does not fail the execution. Check the node output after setup or attach an error workflow.
  • The workflow does not deduplicate repeated submissions.
  • Google Sheets cells that start with =, +, - or @ get a leading apostrophe to block formula injection.