See llms.txt for all machine-readable content.

Back to Templates

Qualify bilingual leads with OpenAI, Google Sheets, and Gmail

Quick overview

This workflow collects Arabic or English service inquiries via an n8n Form, validates and scores them with OpenAI, logs each submission to Google Sheets, and routes bilingual acknowledgment and owner alert emails through Gmail based on intent, score, and confidence.

How it works

  1. Receives a lead submission from an n8n Form trigger.
  2. Cleans and validates the submitted fields, flags spam patterns or blocked senders, and rejects invalid inputs.
  3. For valid leads, sends the service and message to OpenAI to return a JSON classification with language, intent, score, summary, and confidence.
  4. Validates the AI output, assigns a routing status (hot/warm/cold/review) using confidence and threshold rules, and prepares rows for the appropriate Google Sheets tabs.
  5. Appends the lead record to the Leads tab and also to Review or Rejected tabs when applicable in Google Sheets.
  6. If Google Sheets writes are confirmed, generates safe HTML email tasks and sends them through Gmail (hot leads also alert the owner, while warm/cold leads receive bilingual acknowledgments).
  7. If Gmail does not confirm a send, emails the owner a failure alert through Gmail without automatically resending the lead acknowledgment.

Setup

  1. In the Config node, replace businessName, ownerEmail, and sheetId, then set setupComplete to true and adjust thresholds, timezone, templates, and validation limits as needed.
  2. Create a Google Sheets document with three tabs named Leads, Rejected, and Review, and add the exact header columns expected by the append step.
  3. Add Google Sheets OAuth2 credentials with edit access to the target spreadsheet.
  4. Add OpenAI credentials for the OpenAI Chat Model and ensure the selected model is available in your account.
  5. Add Gmail OAuth2 credentials with permission to send email from your chosen mailbox, and verify the owner and reply email addresses are correct.