📲 Developer Specification Document

ALP Astrology
WhatsApp Automation System

Complete workflow blueprint for the Website Team and WhatsApp API Backend Team to build the auto-reply consultation system.

🗓 Version 1.0 — April 2025 👥 For: Frontend + Backend Teams 📱 Platform: WhatsApp Cloud API 🔮 Client: ALP Astrology
System Overview
6
Main Menu Flows
2
Language Modes (Tamil / English)
7
Database Tables Required
🎯 System Goal

Convert social media visitors → WhatsApp users → consultation leads → course students automatically, with zero manual effort for routine queries.

  • Auto greet users based on time of day
  • Detect & store language preference (Tamil / English)
  • Provide structured navigation menu
  • Explain ALP Astrology concept automatically
  • Capture consultation leads with birth details
  • Register course interest with batch preference
  • Share pricing without human involvement
  • Hand over to human support when needed
  • Store all user data in structured database
  • Connect website forms to WhatsApp API webhook
📍 User Journey — Entry Flow
📲

Traffic Sources

Users arrive from multiple platforms and click the WhatsApp CTA button.

📘 Facebook Post 📷 Instagram Reel ▶ YouTube Video 🌐 Website CTA
💬

WhatsApp Entry

Each traffic source opens WhatsApp with a pre-filled message via the wa.me link.

https://wa.me/91XXXXXXXXXX
  ?text=Hello!%20Can%20I%20get%20more%20info%3F
🔄

Complete Entry Flow Steps

01 User clicks WhatsApp button on social media / website 02 WhatsApp opens with pre-filled text: "Hello! Can I get more info?" 03 User sends message → Webhook receives it 04 System detects: First message from this number? 05 Smart Greeting Engine fires based on current time 06 Language selection prompt sent 07 User selects 1 (Tamil) or 2 (English) → stored in DB 08 Main Menu sent in chosen language
🧠 Smart Greeting Engine
🌟

Time-Based Auto Greeting Logic

Time RangeGreeting SentEmoji
06:00 – 11:59Good Morning🌞
12:00 – 16:59Good Afternoon☀️
17:00 – 20:59Good Evening🌆
21:00 – 05:59Good Night🌙
📱

Sample Greeting + Language Selection Message

📌 Developer Note: Store selection as user.language = "ta" or "en" in the users table. All subsequent messages must use this language.

📋 Main Menu — Primary Navigation
🔀 All 6 Automated Flows
🔮

Flow 1 — About ALP Astrology

Trigger: Reply 1

Keywords also trigger this: alp what is alp astrology system

🧿

Flow 2 — Services & Consultation

Trigger: Reply 2

Keywords: consultation prediction service

🎓

Flow 3 — Courses & Learning

Trigger: Reply 3

Keywords: course learn class training

📌 Sub-flow on selecting Basic: Show batch options → Morning / Evening → Collect enrollment details → Confirm

💰

Flow 4 — Pricing Details

Trigger: Reply 4

Keywords: fees price cost

📅

Flow 5 — Book Appointment

Trigger: Reply 5

Keywords: book appointment

System asks user to submit birth details one by one, OR sends the website booking link.

Ask → Name Ask → Address Ask → Contact Number Ask → WhatsApp Number Ask → Date of Birth (DD/MM/YYYY) Ask → Time of Birth Ask → Place of Birth → Save all to consultations table in database → Reply: "✅ Thank you! Fee: ₹3000. We will contact you shortly."
👨‍💼

Flow 6 — Human Support Handover

Trigger: Reply 6

📌 Developer Action: Forward chat to Admin WhatsApp number AND log in CRM dashboard. Mark user state as human_handover = true so bot does not auto-reply further.

🤖 Fallback — Unknown Message Handler

When the bot receives a message it cannot recognize, it sends the fallback menu to re-engage.

🧠 Smart Keyword → Flow Map
User TypesBot Routes ToPriority
alp / what is alp / astrologyFlow 1 — About ALPMedium
consultation / prediction / serviceFlow 2 — ServicesHigh
course / learn / class / trainingFlow 3 — CoursesHigh
fees / price / cost / chargeFlow 4 — PricingMedium
book / appointment / scheduleFlow 5 — AppointmentHigh
support / help / talk / humanFlow 6 — HandoverLow
🌐 Website Team (HTML Frontend) — Tasks
🔗

Task 1 — Landing Page CTA Buttons

Add WhatsApp click buttons on every page. Use these URLs:

// Start WhatsApp Chat Button
<a href="https://wa.me/91XXXXXXXXXX
  ?text=Hello%20ALP%20Astrology"
>
  Start WhatsApp Chat
</a>
  • Start WhatsApp Chat button
  • Book Consultation button
  • Join Course button
📝

Task 2 — Consultation Form Page

Build an HTML form that POSTs data to the backend webhook and sends an email notification.

  • Name (text)
  • Address (textarea)
  • Contact Number (tel)
  • WhatsApp Number (tel)
  • Date of Birth (date)
  • Time of Birth (time)
  • Place of Birth (text)

On submit → POST to webhook → Save to DB → Send email alert to admin

🎓

Task 3 — Course Enrollment Page

Fields Required
  • Student Full Name
  • Mobile Number
  • WhatsApp Number
  • Email Address
Dropdowns
  • Course Name selection
  • Batch: Morning / Evening
  • Payment mode
Actions on Submit
  • Save to course_leads table
  • Trigger WhatsApp confirmation
  • Email notification to admin
🔗 System Architecture Flow
📱 Social Media / Website
💬 WhatsApp Button Click (wa.me link)
☁️ WhatsApp Cloud API (Meta)
🔔 Webhook Server (Node.js / Python)
⚙️ Flow Logic Engine (State Machine)
🗄️ Database Storage (Supabase / MySQL)
📊 Admin Panel / CRM Dashboard
🧰 Recommended Tech Stack
📲

WhatsApp API Options

ProviderRecommendation
Meta WhatsApp Cloud API✅ Recommended
WATIGood
Twilio WhatsAppGood
GupshupAlternative
360DialogAlternative
⚙️

Backend & Database Stack

LayerOptions
Backend ServerNode.js · Python Flask · Firebase Functions
DatabaseSupabase · MySQL · MongoDB · Firebase
Email AlertsSendGrid · Nodemailer · SMTP
HostingVercel · Railway · Render · AWS
🗄️ Database Tables Required
👤usersphone, name, language, state, created_at
📅consultationsuser_id, dob, tob, pob, address, fee, status
🎓course_leadsuser_id, course, batch, enrolled_at, paid
💬chat_logsuser_id, message, direction, timestamp
🌐language_selectionuser_id, lang_code, selected_at
📋appointmentsuser_id, date, time, mode, confirmed
🔑sessionsuser_id, current_flow, step, last_active
📋 Team Task Summary
🌐

Website Team (HTML Frontend)

  • Build landing page with WhatsApp CTA buttons
  • Create Consultation HTML form (7 fields)
  • Create Course Enrollment page
  • Connect forms to backend API webhook via POST
  • Add email notification trigger on form submit
  • Ensure mobile-responsive design for all pages
📲

WhatsApp API Team (Backend)

  • Set up Meta WhatsApp Cloud API & Webhook
  • Build state machine for 6 flows + fallback
  • Implement time-based greeting engine
  • Implement language detection & storage
  • Implement keyword → flow routing
  • Build all 7 database tables
  • Create Admin CRM panel for lead management
  • Human handover logic (pause bot for agent)