Quick Overview
This workflow receives website contact-form submissions via a webhook, uses OpenAI to classify and summarize the message and draft a reply, routes spam separately, alerts your team in Slack, sends an auto-reply with Gmail, logs the submission to Google Sheets, and returns a JSON acknowledgement.
How it works
- Receives a contact-form POST request (name, email, message) via an n8n webhook endpoint.
- Sends the submission to OpenAI (gpt-4o-mini) to classify category/urgency/sentiment, generate a one-sentence summary, and draft a language-matched email reply in strict JSON.
- Normalizes the AI output into consistent fields (timestamp, category, urgency, sentiment, summary, suggested reply) for downstream routing.
- Checks whether the message is classified as spam and, if so, appends a flagged row to Google Sheets and skips notifications and email.
- For non-spam submissions, posts a formatted alert to a Slack channel with the sender details and AI summary.
- Sends the AI-drafted auto-reply to the visitor using Gmail, logs the submission to Google Sheets, and responds to the original webhook request with {"status":"received"}.
Setup
- Create and connect credentials for OpenAI, Slack, Gmail, and Google Sheets in n8n.
- Update the Google Sheets document ID and choose the target sheet name for both the normal submission log and the spam log.
- Select the Slack channel where alerts should be posted.
- Copy the webhook URL from the workflow and configure your website/contact form to POST name, email, and message to it.