RFQ โ CRM Automation & Integration Platform
This system is a production-grade, AI-powered Request-For-Quotation automation platform built for Alrouf Lighting. It replaces manual email-based RFQ handling with an intelligent, event-driven pipeline that:
- Reads incoming RFQ emails via IMAP
- Uses Gemini LLM to extract structured business data
- Persists logs into Google Sheets
- Archives attachments to Google Drive
- Creates CRM opportunities (mock)
- Sends customer acknowledgements
- Alerts sales teams in Slack
This platform demonstrates how modern AI + orchestration replaces entire back-office teams with deterministic, auditable automation.
- ๐ท๏ธ Project Title
- ๐งพ Executive Summary
- ๐ Table of Contents
- ๐งฉ Project Overview
- ๐ฏ Objectives & Goals
- โ Acceptance Criteria
- ๐ป Prerequisites
- โ๏ธ Installation & Setup
- ๐ API Documentation
- ๐ฅ๏ธ UI / Frontend
- ๐ข Status Codes
- ๐ Features
- ๐งฑ Tech Stack & Architecture
- ๐ ๏ธ Workflow & Implementation
- ๐งช Testing & Validation
- ๐ Validation Summary
- ๐งฐ Verification Testing Tools
- ๐งฏ Troubleshooting & Debugging
- ๐ Security & Secrets
- โ๏ธ Deployment
- โก Quick-Start Cheat Sheet
- ๐งพ Usage Notes
- ๐ง Performance & Optimization
- ๐ Enhancements & Features
- ๐งฉ Maintenance & Future Work
- ๐ Key Achievements
- ๐งฎ High-Level Architecture
- ๐๏ธ Project Structure
- ๐งญ How to Demonstrate Live
- ๐ก Summary, Closure & Compliance
The RFQ Automation Platform is built on n8n as a distributed workflow engine. Incoming emails are treated as real-time business events. The workflow stored in RFQ_to_CRM_Workflow.json contains 20 interconnected nodes orchestrating data extraction, validation, CRM simulation, storage, and communication.
| Goal | Implementation |
|---|---|
| Zero manual RFQ handling | IMAP trigger + Gemini extraction |
| Traceability | Google Sheets Master Log |
| Instant response | Gmail Auto-Reply Node |
| Sales visibility | Slack alerts with parsed RFQ data |
| Scalable CRM readiness | Mock CRM simulating Salesforce/Odoo |
- Every RFQ email must generate a CRM ID
- No duplicate emails may be processed
- All attachments must be archived
- Slack notification must include RFQ value, company, and email
- All failures must be written to Error_Log.json
- n8n v1.x
- Google Workspace API access
- Slack Bot Token
- Gemini API Key
- Gmail IMAP Enabled
- Install n8n (local or cloud)
- Import RFQ_to_CRM_Workflow.json
- Connect Google, Slack, Gmail credentials
- Verify Google Sheet IDs
- Enable workflow
This platform exposes its integration surface via n8n service connectors and internal REST-style webhooks.
| Component | Endpoint / Node | Purpose |
|---|---|---|
| IMAP Trigger | imap.gmail.com | Reads RFQ emails |
| Gemini LLM | POST /v1/models/gemini:generateContent | Extracts RFQ fields |
| Google Sheets | AppendRow API | Stores RFQ logs |
| Google Drive | Files.upload | Stores RFQ attachments |
| Slack | chat.postMessage | Sends sales alerts |
| Gmail | messages.send | Sends acknowledgements |
This system is backend-driven and operates via n8nโs orchestration UI.
- Dashboard: n8n workflow canvas showing node execution states
- Input: Gmail inbox receiving RFQs
- Data Views: Google Sheets (RFQ_Master_Log, RFQ_Parsed_Data)
- Sales UI: Slack channel notifications
- File UI: Google Drive RFQ_Attachments folder
| Code | Meaning |
|---|---|
| 200 | RFQ processed successfully |
| 202 | RFQ queued for processing |
| 409 | Duplicate RFQ detected |
| 422 | LLM extraction failed |
| 500 | Workflow execution error |
- LLM-based email understanding
- Multi-sheet data persistence
- Drive-based attachment archival
- CRM simulation engine
- Bilingual auto-reply support
- Duplicate prevention via Message-ID hashing
- Structured error logging
Email โ IMAP โ n8n โ Gemini AI โ Sheets โ CRM โ Drive โ Gmail โ Slack
- IMAP detects new RFQ email
- Message-ID checked against Google Sheets
- Email text sent to Gemini for extraction
- JSON output normalized
- Raw email stored
- Parsed fields stored
- CRM ID generated
- Files uploaded
- Auto-reply sent
- Slack notified
| ID | Area | Test | Expected | Explanation |
|---|---|---|---|---|
| T01 | Send RFQ email | Workflow triggers | IMAP picks new mail | |
| T02 | LLM | Unstructured RFQ | JSON extracted | Gemini parsing |
| T03 | CRM | Mock insert | CRM ID generated | Function node |
| T04 | Slack | Notify | Message delivered | Sales alert |
- 100% of RFQs processed in test runs
- No duplicates passed deduplication
- All attachments archived
- CRM IDs generated for each RFQ
- n8n Execution Logs
- Google Sheets audit trail
- Slack message history
- CRM_Mock_Log.json
- Error_Log.json
| Issue | Cause | Resolution |
|---|---|---|
| No email trigger | IMAP misconfigured | Re-auth Gmail |
| LLM failure | API quota | Rotate Gemini key |
| Sheet not updated | Permission error | Re-share sheet |
| Slack not posting | Token revoked | Generate new token |
- OAuth2 for Google APIs
- Slack Bot Token stored in n8n credentials
- Gemini API keys stored in .env
- All secrets excluded via .gitignore
- n8n Cloud or VPS-based Docker deployment
- Google APIs enabled on production account
- Dedicated Gmail inbox for RFQs
- Slack workspace configured
- Import workflow JSON
- Connect credentials
- Send RFQ email
- Check Sheets, Drive, Slack
- One inbox per company
- Arabic & English RFQs supported
- Attachments auto-archived
- CRM mock replaceable with Salesforce
- Parallel CRM + Drive processing
- Deduplication via Message-ID hash
- LLM token optimization
- Batch Google Sheet writes
- Salesforce integration
- Odoo CRM sync
- OCR on attachments
- Analytics dashboard
- Credential rotation
- LLM model upgrades
- Scaling Sheets โ BigQuery
- Queue-based retry engine
- 100% automation of RFQ flow
- Zero manual CRM entry
- Instant client acknowledgement
- Sales-ready alerts in seconds
Client โ Gmail โ IMAP โ n8n โ Gemini AI โ Sheets โ CRM โ Drive โ Gmail โ Slack
RFQ_to_CRM_Automation/ โโโ Workflow_JSON/ โ โโโ RFQ_to_CRM_Workflow.json โ โโโ CRM_Mock_Log.json โ โโโ Error_Log.json โ โโโ Example_Input_Email.json โ โโโ Sample_Output_Data.json โโโ Documentation/ โโโ Screenshots/ โโโ Auto_Reply_Sample.txt โโโ Sample_Raw_Email.eml โโโ Master_README.md