Top

Wapi documentation

Chat, collaborate, and create teams effortlessly with Wapi

Welcome to WAPI!

Get an AI summary of this page

Getting Started

These are the steps required to set up the chat application manually on Windows.

Steps:

  • - MongoDB Installation
  • - Node.js Installation (Standard)

MongoDB Setup (Windows)

  • - Download & Install MongoDB Community Server:

    • https://www.mongodb.com/try/download/community
    • - Select:

      • - Version: Latest stable (e.g. 7.x or 8.x)

      • - Platform: Windows

      • Package: MSI

    • - Download and run the .msi installer

    • - During installation choose:

        • - Complete setup (recommended)

        • - Check Install MongoDB as a Service (very useful for production/local)

        • - Check Install MongoDB Compass (GUI – optional but recommended)

        • - Uncheck "Install MongoD as Network Service" if you want to run under your user


  • After installation

  • - MongoDB is usually installed in:

      • C:\Program Files\MongoDB\Server\<version>\bin
  • - Add MongoDB to PATH (if not already done by installer):

    • Add:

      • C:\Program Files\MongoDB\Server\<version>\bin to system PATH
  • - Start/Verify Service (recommended) :

    The installer usually creates the service. Check:

      • services.msc → MongoDB → Status: Running
    • If not running → start it manually from services.

  • - Verify Installation :

      • mongod --version
      • mongosh --version
  • - Connect & Create Database + User (using mongosh) :

    Open Command Prompt or PowerShell:

    - mongosh

    Inside mongosh:

      • // Switch to admin database first
      • use admin
      • // Create admin user (very recommended)
      • db.createUser ({
      • user: "admin",
      • pwd: "StrongAdminPass123!",
      • roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
      • })
      • // Exit and reconnect with admin user
      • exit
      • mongosh -u admin -p StrongAdminPass123! --authenticationDatabase admin
      • // Now create application user & database
      • use wapi
      • db.createUser ({
      • user: "wapi_user",
      • pwd: "T$123eam",
      • roles: [
      • { role: "readWrite", db: "wapi" }
      • ]
      • })
      • // Exit
      • exit

    Connection String Examples (use in .env)

      • mongodb://wapi_user:T$123eam@localhost:27017/wapi

Getting Started (macOS)

These are the steps required to set up the chat application manually on macOS.

Steps:

  • - MongoDB Installation via Homebrew
  • - Node.js Installation

MongoDB Setup (macOS)

  • - Install MongoDB using Homebrew

      • # Update brew
      • brew update
      • # Install mongodb-community
      • brew tap mongodb/brew
      • brew install mongodb-community@8.0
      • # Start MongoDB
      • brew services start mongodb/brew/mongodb-community
  • - Verify:

      • use admin
      • db.createUser ({
      • user: "admin",
      • pwd: "StrongAdminPass123!",
      • roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
      • })
      • exit
      • mongosh -u admin -p StrongAdminPass123! --authenticationDatabase admin
      • use wapi
      • db.createUser ({
      • user: "wapi_user",
      • pwd: "T$123eam",
      • roles: [{ role: "readWrite", db: "wapi" }]
      • })
  • - Connection String:

      • mongodb://wapi_user:T$123eam@localhost:27017/wapi

Getting Started (Linux)

Recommended for Ubuntu 22.04 / 24.04 and other Debian-based distributions.

Steps:

  • - Install MongoDB via APT
  • - Configure Service

MongoDB Setup (Linux)

  • - Install MongoDB Community Edition

    • sudo apt-get install gnupg curl
    • curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor
    • echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
    • sudo apt-get update
    • sudo apt-get install -y mongodb-org
  • - Start & Enable MongoDB

    • sudo systemctl start mongod
    • sudo systemctl enable mongod
  • - Verify and Create User (Standard mongosh process)

    Run mongosh and follow the same creation steps as Windows/Mac tabs.

Node.js Setup (Cross-Platform)

Installation paths for different operating systems:

  • - Download & Install Node.js (LTS)

    • Official Site: https://nodejs.org/
    • Windows & macOS: Download the relevant installer (.msi or .pkg) and follow the wizards.

    • Linux (Ubuntu/Debian):

      • curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
      • sudo apt-get install -y nodejs
  • - Verify Installation

    • node -v
    • npm -v

    Successful installation will output version numbers (e.g., v22.x.x).

  • - Install PM2 (Process Manager)

    Essential for production to keep your app running in the background.

    • npm install pm2 -g
    • pm2 -v

Deploy the Application Code

Upload the Wapi backend folder or clone it directly from your repository:

  • git clone <your-repo-url>
  • cd wapi-backend
  • npm install --production

After installation, create a .env file and add all required backend configuration values.

Detailed Environment Configuration

The .env file is critical for the Wapi backend to interact with third-party services like Stripe, Razorpay, PayPal, and Meta (WhatsApp). Ensure you copy .env.example to .env and fill in the following values.

Category Variables Description & Sources
Stripe (Global) STRIPE_SECRET_KEY
STRIPE_PUBLISHABLE_KEY
STRIPE_WEBHOOK_SECRET
Supported Currencies: 135+ (USD, EUR, GBP, INR, etc.).
How to get: Log in to Stripe Dashboard -> Developers -> API Keys. Webhook secret is in Developers -> Webhooks.
Razorpay (India) RAZORPAY_KEY_ID
RAZORPAY_KEY_SECRET
RAZORPAY_WEBHOOK_SECRET
Supported Currencies: INR (Primary), 90+ International.
How to get: Go to Razorpay Dashboard -> Settings -> API Keys -> Create Key.
PayPal (Global) PAYPAL_MODE (live/sandbox)
PAYPAL_CLIENT_ID
PAYPAL_CLIENT_SECRET
PAYPAL_WEBHOOK_ID
Supported Currencies: 25+ (USD, EUR, GBP, JPY, AUD, CAD, etc.).
How to get: Visit PayPal Developer Portal -> My Apps & Credentials -> Create App.
WhatsApp (Meta) Flow WHATSAPP_VERIFY_TOKEN How to get: Defined by you in the Meta App Dashboard under the WhatsApp -> Configuration section for webhook verification.
Auth & Google JWT_SECRET
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
GOOGLE_REDIRECT_URI
FRONT_REDIRECT_URL
FRONTEND_URL
How to get: JWT_SECRET is your own random secure string. Google keys are in Google Cloud Console. For detailed Google Integration steps, refer to our Admin Settings Guide.
Database & Cache MONGODB_URI
REDIS_HOST
REDIS_PORT
REDIS_PASSWORD
REDIS_URL
How to get: MONGODB_URI is your connection string from MongoDB Atlas or local install. Redis values depend on your server setup (default: localhost:6379).
Email (SMTP) SMTP_HOST
SMTP_PORT
SMTP_USER
SMTP_PASS
MAIL_FROM_NAME
MAIL_FROM_EMAIL
SUPPORT_EMAIL
How to get: Credentials from your email provider (e.g., Gmail App Password or SendGrid API Keys).
App Settings PORT
DEMO
APP_URL
ALLOWED_ORIGINS
MAINTENANCE_MODE
Basic application configuration. PORT defaults to 3000. DEMO mode enables/disables public demo features.
APP_URL: Your backend URL, used for Webhooks (e.g., your ngrok URL for local testing).
ALLOWED_ORIGINS: Comma-separated list of allowed frontend domains for CORS.

Complete .env Template

  • # APP CONFIG
  • PORT=3000
  • DEMO=true
  • APP_URL=https://yourdomain.com
  • SERVER_ADDR=
  • # APP ID (Do not change this)
  • APP_ID=VVlHTldWMk4wSQ==
  • ALLOWED_ORIGINS=
  • FRONTEND_URL=https://your-frontend.com
  • MAINTENANCE_MODE=false
  • # ADMIN CONFIG
  • ADMIN_NAME=Admin
  • ADMIN_EMAIL=admin@example.com
  • ADMIN_PASSWORD=your_secure_password
  • # DATABASE & CACHE
  • MONGODB_URI=mongodb://127.0.0.1:27017/wapi
  • REDIS_HOST=127.0.0.1
  • REDIS_PORT=6379
  • REDIS_PASSWORD=
  • REDIS_URL=
  • # SECURITY
  • JWT_SECRET=your_jwt_secret_here
  • # STRIPE
  • STRIPE_SECRET_KEY=sk_test_...
  • STRIPE_PUBLISHABLE_KEY=pk_test_...
  • STRIPE_WEBHOOK_SECRET=whsec_...
  • # RAZORPAY
  • RAZORPAY_KEY_ID=rzp_test_...
  • RAZORPAY_KEY_SECRET=...
  • RAZORPAY_WEBHOOK_SECRET=...
  • # PAYPAL
  • PAYPAL_MODE=sandbox
  • PAYPAL_CLIENT_ID=...
  • PAYPAL_CLIENT_SECRET=...
  • PAYPAL_WEBHOOK_ID=...
  • # WHATSAPP / META
  • WHATSAPP_VERIFY_TOKEN=your_custom_token
  • # GOOGLE AUTH
  • GOOGLE_CLIENT_ID=...
  • GOOGLE_CLIENT_SECRET=...
  • GOOGLE_REDIRECT_URI=https://yourdomain.com/api/auth/google/callback
  • FRONT_REDIRECT_URL=https://your-frontend.com/login
  • # EMAIL
  • SMTP_HOST=...
  • SMTP_PORT=...
  • SMTP_USER=...
  • SMTP_PASS=...
  • MAIL_FROM_NAME="Wapi Support"
  • MAIL_FROM_EMAIL=no-reply@yourdomain.com
  • SUPPORT_EMAIL=support@yourdomain.com
  • FACEBOOK_LEAD_WEBHOOK_VERIFY_TOKEN=your_custom_token

The .env file ensures the backend loads settings securely and consistently across environments.

How to Run Seeding

To seed all data to the database, navigate to your backend directory and run the following command:

  • npm run seed

Note: Ensure your .env file is correctly configured with your MongoDB connection string before running the seed command.

Tip: After updating the .env file, make sure to rebuild and restart your application:
  • For Backend:
  • pm2 restart all