Manage coupon campaigns and customer chats with WhatsApp and PostgreSQL
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
Nodes used (7)
- Webhook
n8n-nodes-base.webhook - Respond to Webhook
n8n-nodes-base.respondToWebhook - Postgres
n8n-nodes-base.postgres - If
n8n-nodes-base.if - Edit Fields (Set)
n8n-nodes-base.set - HTTP Request
n8n-nodes-base.httpRequest - Switch
n8n-nodes-base.switch
What it does
Coupon Bot Dashboard & WhatsApp Management System A complete bilingual admin dashboard and WhatsApp bot solution for managing discount coupons, partner companies, and customer conversations through an intuitive web interface and automated chatbot. What does this workflow do? This workflow provides a comprehensive coupon management system with dual interfaces: a modern Vue.js admin dashboard for managers and an interactive WhatsApp bot for customers. It handles everything from company onboarding and coupon issuance to real-time customer support and conversation tracking. Key features: - 🎛️ Admin Dashboard - Full-featured Vue.js 3 interface with Tailwind CSS for managing companies, coupons, and viewing analytics - 🤖 WhatsApp Bot - Automated customer service bot with session-based state management - 🏢 Company Management - CRUD operations for partner companies and their coupon catalogs - 🎫 Advanced Coupon System - Support for percentage/fixed discounts, expiry dates, minimum purchase requirements, and maximum discount caps - 💬 Real-time Inbox - Live chat interface for viewing customer conversation history - 🌐 Bilingual Support - Full Arabic (RTL) and English interface support - 📊 Analytics Dashboard - Track customers, messages, coupons issued, and partner companies - 🔧 Database Tools - Built-in schema initialization and migration capabilities - 👤 Role-Based Access - Separate admin and customer flows with phone number authentication Setup Requirements Integrations Needed: 1. PostgreSQL - Primary database for all system data 2. WhatsApp Business API - For customer bot interactions via Facebook Graph API 3. n8n - Workflow automation platform (self-hosted or cloud) Credentials Required: - PostgreSQL database credentials (host, port, database, user, password) - WhatsApp Business API Bearer Token (Facebook Graph API v22.0) - Phone Number ID from WhatsApp Business account How to Use Initial Setup: 1. Import the workflow into your n8n instance 2. Configure PostgreSQL credentials - Connect to your database (named "discounts DB" in the workflow) 3. Configure WhatsApp credentials - Add your Facebook Graph API Bearer Token 4. Initialize the database - Send POST request to /webhook/coupon-bot/execute-init to create all tables 5. Set admin phone - Access dashboard at /webhook/coupon-bot/dashboard, go to Settings, and set your admin phone number 6. Configure WhatsApp webhook - Point your WhatsApp Business webhook to /webhook/whatsapp Dashboard Access: - URL: /webhook/coupon-bot/dashboard - Features: Statistics, Company Management, Coupon Management, Inbox, System Settings Admin WhatsApp Commands: Once your phone is set as admin, send any message to the bot to access: - Add/Edit/Delete Companies - Add/Edit/Delete Coupons - Edit Welcome/End Messages - Browse as regular customer Workflow Structure 1. Dashboard Webhook (/coupon-bot/dashboard) Serves the complete Vue.js 3 admin interface with: - Responsive RTL layout for Arabic - Mobile-optimized sidebar navigation - Real-time statistics cards - Company and coupon management forms - Interactive inbox with chat history - System settings and database maintenance tools 2. API Endpoints (/coupon-bot/api/) RESTful API routes for dashboard operations: - POST /stats - System analytics (customers, messages, records, companies) - POST /companies - CRUD operations for partner companies - POST /coupons - CRUD operations with advanced fields (percentage, expiry, limits) - POST /inbox - Retrieve unique customer conversations - POST /history - Fetch complete chat history for a customer - POST /settings - Manage admin phone and message templates - POST /customers - Customer records retrieval - POST /records - Coupon redemption tracking 3. Database Management (/coupon-bot/execute-init, /coupon-bot/migrate) - Full Initialization - Creates all tables: customers, companies, coupons, records, messages, settings, sessions - Schema Migration - Non-destructive updates to add missing columns and constraints - Repai