Hobby Project · Node.js · WhatsApp

WhatsApp Gold Chatbot

A conversational WhatsApp bot for a gold dealer — handling sell gold & trade-in flows with live pricing, session management, and a real-time admin dashboard.

Screen 1 — Admin Dashboard
9:41 Gold Bot Dashboard ● ▲ 🔋
🤖
Faisal Gold Bot
Connected · whatsapp-web.js
12
Messages Today
3
Active Sessions
5
Sell Inquiries
2
Trade-ins
Live Gold Prices
999 (24K)
Sell: RM 392.00/g
RM 380.50/g
916 (22K)
Sell: RM 358.00/g
RM 348.20/g
750 (18K)
Sell: RM 295.00/g
RM 285.50/g
375 (9K)
Sell: RM 148.00/g
RM 142.80/g
Admin Commands
!setprice 916 350.00 !resetprice !prices !help
Screen 2 — Sell Gold Flow (Chat)
10:24 Faisal Gold ● ▲ 🔋
Today
Selamat datang ke Faisal Gold! 🏅
Welcome to Faisal Gold!

Apa yang boleh kami bantu?

1️⃣ Jual Emas (Sell Gold)
2️⃣ Tukar Emas (Trade-in Gold)
3️⃣ Semak Harga (Gold Price)
4️⃣ Hubungi Kami (Contact Us)
5️⃣ Soalan Lazim (FAQ)

Balas 1-5 ✨ 10:24
1 10:24 ✓✓
Sell Gold 💰

Please select your gold type:

1️⃣ 999 (24K) — Pure Gold
2️⃣ 916 (22K)
3️⃣ 750 (18K)
4️⃣ 375 (9K)

Or type menu to go back. 10:24
1 10:25 ✓✓
You selected: 999 (24K)

Please enter the weight in grams.

Example: 10.5 10:25
10 10:25 ✓✓
Your Gold Sell Offer 💰

Type:      999 (24K)
Weight:   10g
Price:     RM 380.50/gram

━━━━━━━━━━━━
💵 Estimated Offer: RM 3,805.00
━━━━━━━━━━━━

Final price subject to verification.

1️⃣ Yes, I'm interested
2️⃣ No, go back 10:25
1 10:26 ✓✓
Great! We'd love to buy your gold.

• Type: 999 (24K)
• Weight: 10g
• Est. Offer: RM 3,805.00

📞 011-1234 5678
📍 Kota Bharu City Point
🕘 9am – 6pm daily

Visit us for verification & same-day cash payment 😊 10:26
😊
Message
🎤
Screen 3 — Gold Prices View
10:30 Faisal Gold ● ▲ 🔋
Today
3 10:30 ✓✓
Gold Prices Today 📊
25 Jun 2026, 10:30 AM
999 (24K)
  We Buy:  RM 380.50/g
  We Sell: RM 392.00/g

916 (22K)
  We Buy:  RM 348.20/g
  We Sell: RM 358.00/g

750 (18K)
  We Buy:  RM 285.50/g
  We Sell: RM 295.00/g

375 (9K)
  We Buy:  RM 142.80/g
  We Sell: RM 148.00/g
Prices may change. Tap 1 to sell. 10:30
1 10:31 ✓✓
Sell Gold 💰

Select your gold type:

1️⃣ 999 (24K)
2️⃣ 916 (22K)
3️⃣ 750 (18K)
4️⃣ 375 (9K) 10:31
😊
Message
🎤
Web Dashboard · 4 Pages

Web Configuration Dashboard

Real-time web UI served by Express + Socket.io — lets the owner configure the bot, monitor gold prices, view automated replies, and connect WhatsApp via QR code.

Page 1 — WhatsApp Connection (QR Code)
🔒 localhost:3000
🏅 Gold Bot
Waiting for scan
Bot
📱 WhatsApp Connection
💬 Bot Replies
Configuration
💰 Gold Prices
⚙️ Settings
WhatsApp Connection
Scan the QR code with your WhatsApp to connect the bot.
Waiting for scan
1
Open WhatsApp on your phone
2
Go to Settings → Linked Devices
3
Tap Link a Device and scan the code above
Page 2 — Bot Replies
🔒 localhost:3000
🏅 Gold Bot
Connected
Bot
📱 WhatsApp Connection
💬 Bot Replies
Configuration
💰 Gold Prices
⚙️ Settings
Bot Replies
These are the automated responses your bot sends to customers.
hi / hello / salam Welcome message + Main menu (Sell, Trade, Price, Contact, FAQ) Greeting
1 — Sell Gold Asks gold type → weight → shows offer price → confirm Sell Flow
2 — Trade-in Have type → weight → want type → shows equivalent weight estimate Trade Flow
3 — Gold Price Shows live buy/sell price per gram for all gold types Price Info
4 — Contact Shows business phone, address, and operating hours Info
5 — FAQ Common questions: gold types accepted, payment, verification time Info
menu / back / 0 Returns customer to main menu from any step Navigation
🔧 Admin Commands (send from your WhatsApp number)
!setprice 916 350.00 — Set manual price for a gold type
!resetprice 916 — Reset that type to live price
!resetprice — Reset all types to live prices
!prices — View all current prices (admin view)
!help — Show admin command list
Page 3 — Gold Prices
🔒 localhost:3000
🏅 Gold Bot
Connected
Bot
📱 WhatsApp Connection
💬 Bot Replies
Configuration
💰 Gold Prices
⚙️ Settings
Gold Prices
Live prices from GoldAPI. Use admin commands to override manually.
999 · 24K
We Buy RM 380.50
We Sell RM 392.00
● Live
916 · 22K
We Buy RM 348.20
We Sell RM 358.00
⚠ Manual
750 · 18K
We Buy RM 285.50
We Sell RM 295.00
● Live
375 · 9K
We Buy RM 142.80
We Sell RM 148.00
● Live
Prices update every 30 minutes from live API. 916 is currently on manual override — type !resetprice 916 in WhatsApp to reset.
Page 4 — Settings
🔒 localhost:3000
🏅 Gold Bot
Connected
Bot
📱 WhatsApp Connection
💬 Bot Replies
Configuration
💰 Gold Prices
⚙️ Settings
Settings
Update your .env file and restart the bot to apply changes.
Business Information
Shown to customers in Contact and FAQ replies.
Business Name
Faisal Gold
Phone Number
+60111234 5678
Address
Kota Bharu City Point
Operating Hours
Mon–Sat, 9:00 AM – 6:00 PM
Margin Settings
How much we adjust from the live gold spot price.
Buy Margin (%)
5
We pay X% below spot price
Sell Margin (%)
3
We charge X% above spot price
💡 How to Apply Changes
1. Open the .env file in the project folder
2. Update values (BUSINESS_NAME, BUSINESS_PHONE, etc.)
3. Stop the bot and run npm start to restart
4. Changes take effect immediately after restart
Tech Stack
whatsapp-web.js
WhatsApp Web automation — QR auth, message send/receive
Node.js + Express
Bot runtime + REST API for dashboard and gold price endpoint
Socket.io
Real-time dashboard updates — QR code, bot status, session count
Session Manager
In-memory state machine tracking user flows across IDLE → CONFIRM states
Gold Price Scraper
Fetches live MYR gold prices with manual override fallback for admins
Admin Commands
WhatsApp-based !setprice, !resetprice, !prices for business owner control