Step-by-Step Guide: Building a WhatsApp AI Visa Assistant with n8n
Introduction
In this article, I’ll explain a complete real-world n8n automation project that turns WhatsApp into an AI-powered Visa Consultancy Assistant.
This workflow is designed for visa consultants, immigration firms, and service businesses who want to:
- Automatically reply to WhatsApp messages
- Ask structured questions
- Understand user intent using AI
- Store leads safely in Google Sheets
- Maintain conversation memory
This guide is written so any beginner or intermediate n8n user can understand and rebuild the same system.
Project Overview
What This Automation Does
When a user sends a message on WhatsApp:
- The workflow is triggered instantly
- An AI agent handles the conversation
- The AI asks mandatory questions (name, address, visa country, profile)
- The AI decides required documents based on the user’s profile
- Extracted data is saved to Google Sheets
- The AI replies back to the user on WhatsApp
- Conversation memory is preserved for follow-ups
This creates a 24/7 smart WhatsApp receptionist for visa services.
Tools & Services Used
- n8n – Workflow automation platform
- WhatsApp Cloud API – Message receiving & sending
- OpenAI (GPT‑4.1‑mini) – AI reasoning & conversation
- LangChain Nodes – AI agent + memory
- Google Sheets – Lead storage (CRM-lite)
Workflow Architecture (High Level)
WhatsApp Message
↓
WhatsApp Trigger
↓
AI Agent (Rules + Logic)
↓
┌───────────────┬────────────────┐
│ Google Sheets │ Memory Storage │
└───────────────┴────────────────┘n ↓
Send WhatsApp Reply
Step 1: WhatsApp Trigger Node
Node: WhatsApp Trigger
This is the entry point of the workflow.
What it does:
- Listens for incoming WhatsApp messages
- Captures:
- User message text
- User WhatsApp number (wa_id)
- Contact metadata
Why it’s important:
Without this node, n8n wouldn’t know when a user sends a message.
Step 2: AI Agent Node (Core Brain)
Node: LangChain AI Agent
This is the heart of the entire automation.
Input Sent to AI:
- User message text
- User phone number
Example:
User Message: Hello
User Phone: 923001234567
Step 3: System Prompt (Business Rules)
The system prompt turns ChatGPT into a Visa Consultancy Assistant.
You are the official AI Visa Assistant of Alif Consultancy.
━━━━━━━━━━━━━━━━━━━━
STRICT FIRST MESSAGE RULE (MANDATORY)
━━━━━━━━━━━━━━━━━━━━
When a new conversation starts, you MUST ask ALL of the following questions
IN ONE MESSAGE and IN THIS EXACT ORDER:
- Full Name
- Contact Number (WhatsApp preferred)
- Current Address (City & Country)
- Which country do you want to apply for visa?
- Are you applying as:
a) Job Holder
b) Business Owner
Do NOT provide document requirements yet.
Do NOT skip any question.
Wait for the user’s reply.
━━━━━━━━━━━━━━━━━━━━
AFTER USER REPLIES
━━━━━━━━━━━━━━━━━━━━
- Extract and store the answers as:
- Full_Name
- Contact_Number
- Current_Address
- Applying_Country
- Applicant_Profile (Job Holder / Business Owner)
- Confirm the details briefly.
- THEN provide documents based on Applicant_Profile.
━━━━━━━━━━━━━━━━━━━━
DOCUMENT LOGIC
━━━━━━━━━━━━━━━━━━━━
If Applicant_Profile = Job Holder:
Basic Documents:
- Passport
- National Identity Card
- Last 6 months Bank Statement
- Family Registration Certificate
- Marriage Certificate (if married)
- Gmail / Email
- Travel history (last 10 years)
- Any previous visa refusal
Job Documents:
- Employment Letter
- Salary Slips (if available)
- Job Contract (if available)
- Leave Approval Letter (if available)
━━━━━━━━━━━━━━━━━━━━
If Applicant_Profile = Business Owner:
Basic Documents:
- Passport
- National Identity Card
- Last 6 months Bank Statement
- Family Registration Certificate
- Marriage Certificate (if married)
- Gmail / Email
- Travel history (last 10 years)
- Any previous visa refusal
Business Documents:
- Business Registration Certificate
- Company Letterhead & Stamp
- Nature of Business
- Tax Documents (if available)
- Partnership Deed (if applicable)
━━━━━━━━━━━━━━━━━━━━
TIMELINES
━━━━━━━━━━━━━━━━━━━━
- File preparation: 07 working days
- Embassy processing: 2–3 months (approx.)
━━━━━━━━━━━━━━━━━━━━
DATA SAVING (GOOGLE SHEETS)
━━━━━━━━━━━━━━━━━━━━
Ensure all extracted fields are passed to Google Sheets accurately.
Never ask for passport numbers or CNIC numbers.
Key Rules Enforced:
1. Mandatory First Message
The AI must ask all questions in one message, in this exact order:
- Full Name
- Contact Number
- Current Address
- Visa Country
- Applicant Profile (Job Holder / Business Owner)
The AI is not allowed to:
- Skip questions
- Ask document requirements early
2. Data Extraction Logic
Once the user replies, the AI must extract:
- Full_Name
- Contact_Number
- Current_Address
- Applying_Country
- Applicant_Profile
These values are later passed to Google Sheets automatically.
3. Conditional Document Logic
The AI dynamically decides document requirements:
If Job Holder:
- Passport
- CNIC
- Bank Statement
- Employment Letter
- Salary Slips
- Leave Approval
If Business Owner:
- Passport
- CNIC
- Bank Statement
- Business Registration
- Tax Documents
- Company Letterhead
This removes the need for manual decision-making.
Step 4: OpenAI Chat Model Node
Node: OpenAI Chat Model
Model Used:
gpt-4.1-mini
Why this model:
- Fast responses
- Cost-effective
- Strong instruction-following
This node supplies intelligence to the AI Agent.
Step 5: Memory Node (Conversation Context)
Node: Simple Memory (Buffer Window)
Purpose:
- Remembers last 20 messages
- Keeps conversation state
- Avoids repeated questions
Session Key:
The session is uniquely tied to:
conversation-id-{WhatsApp_Number}
This ensures each user has their own memory.
Step 6: Google Sheets Tool Node
Node: Append or Update Row
This node acts as a mini CRM.
What it does:
- Saves user details into Google Sheets
- Updates existing rows if name already exists
Columns Stored:
- Full Name
- Contact Number
- Current Address
- Visa Country
Smart Feature:
AI automatically maps extracted fields using $fromAI() expressions.
Step 7: Send WhatsApp Message Node
Node: Send Message
What it does:
- Sends AI-generated replies back to the user
- Uses WhatsApp Cloud API
Message Content:
{{$json.output}}
This ensures natural, human-like replies.
How Nodes Are Connected
- WhatsApp Trigger → AI Agent
- AI Agent → Send Message
- AI Agent ↔ OpenAI Model
- AI Agent ↔ Memory
- AI Agent ↔ Google Sheets
The AI Agent acts as a central controller.
Security & Privacy Rules
- No passport numbers requested
- No CNIC numbers stored
- Only basic lead data saved
- WhatsApp number used only for session tracking
This makes the system privacy-friendly.
Real-World Benefits
✅ 24/7 WhatsApp automation
✅ Zero missed leads
✅ No manual data entry
✅ Scalable visa consultancy system
✅ Professional AI behavior
Who Should Use This Workflow
- Visa & Immigration Consultants
- Travel Agencies
- Overseas Job Consultants
- Digital Agencies offering automation services
Final Thoughts
This n8n project shows how powerful AI + WhatsApp + Automation can be when combined correctly.
With one workflow, you:
- Automate conversations
- Qualify leads
- Store data
- Improve customer experience
You can customize this system for:
- Admissions
- Real estate
- Customer support
- Appointment booking
