Bot WA AI untuk E-commerce
Panduan lengkap bot AI WhatsApp untuk toko online. Order, payment, shipping, customer service. All-in-one guide!
E-commerce + AI Bot = 24/7 Sales Machine!
Bot AI untuk e-commerce bisa handle product discovery, order processing, payment verification, shipping updates, dan customer service - semuanya otomatis!
E-commerce Bot Features
π FITUR LENGKAP:
DISCOVERY:
- Product search
- Recommendations
- Catalog browsing
- Price inquiry
ORDERING:
- Add to cart
- Checkout process
- Payment instructions
- Order confirmation
FULFILLMENT:
- Order tracking
- Shipping updates
- Delivery confirmation
SUPPORT:
- FAQ handling
- Return/refund
- Complaint handling
- Human escalationSystem Architecture
ποΈ ARCHITECTURE:
βββββββββββββββββββββββββββββββββββββββ
β WhatsApp Users β
ββββββββββββββββ¬βββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β WhatsApp Bot (Baileys/API) β
ββββββββββββββββ¬βββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β AI Engine (GPT/Claude) β
β β’ Intent detection β
β β’ Response generation β
β β’ Product matching β
ββββββββββββββββ¬βββββββββββββββββββββββ
β
βββββββββββΌββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββ
β Product ββ Order ββ Customerβ
β DB ββ DB ββ DB β
βββββββββββββββββββββββββββββββββComplete System Prompt
javascript
const ECOMMERCE_PROMPT = `Kamu adalah Tia, AI shopping assistant untuk [BRAND].
TENTANG TOKO:
- Toko fashion wanita online
- Berdiri sejak 2020, trusted seller
- Rating 4.9/5 dari 10,000+ reviews
PRODUK:
- Dress: Rp 150,000 - 500,000
- Blouse: Rp 100,000 - 250,000
- Celana: Rp 120,000 - 300,000
- Outerwear: Rp 200,000 - 450,000
- Aksesoris: Rp 50,000 - 150,000
KEBIJAKAN:
- Free ongkir Jabodetabek min. Rp 200,000
- Ongkir luar Jabodetabek: dari Rp 15,000
- Retur: 7 hari setelah terima (syarat berlaku)
- Garansi jahitan: 30 hari
PEMBAYARAN:
- Transfer: BCA 1234567890 a/n [BRAND]
- E-wallet: GoPay, OVO, DANA
- COD: Jabodetabek only
PENGIRIMAN:
- JNE, J&T, SiCepat
- Jabodetabek: 1-2 hari
- Jawa: 2-3 hari
- Luar Jawa: 3-5 hari
TUGAS KAMU:
1. Bantu customer cari produk yang cocok
2. Jawab pertanyaan dengan akurat
3. Proses order dengan lengkap
4. Update status pengiriman
5. Handle komplain dengan empati
GAYA KOMUNIKASI:
- Panggil "Kak"
- Ramah dan helpful
- Emoji secukupnya
- Bahasa Indonesia casual tapi sopan
ATURAN PENTING:
- Jangan membuat harga/promo yang tidak ada
- Jika tidak yakin, bilang akan cek ke tim
- Komplain serius β eskalasi ke human
- Selalu konfirmasi sebelum proses order`;Product Discovery
javascript
const productTools = [
{
type: 'function',
function: {
name: 'search_products',
description: 'Search products by keyword, category, or filters',
parameters: {
type: 'object',
properties: {
query: { type: 'string' },
category: { type: 'string' },
minPrice: { type: 'number' },
maxPrice: { type: 'number' },
color: { type: 'string' },
size: { type: 'string' }
}
}
}
},
{
type: 'function',
function: {
name: 'get_product_details',
description: 'Get detailed info about a specific product',
parameters: {
type: 'object',
properties: {
productId: { type: 'string' }
},
required: ['productId']
}
}
},
{
type: 'function',
function: {
name: 'get_recommendations',
description: 'Get product recommendations based on preferences',
parameters: {
type: 'object',
properties: {
occasion: { type: 'string' },
style: { type: 'string' },
budget: { type: 'number' }
}
}
}
}
];
async function searchProducts({ query, category, minPrice, maxPrice, color, size }) {
const filter = { active: true, stock: { $gt: 0 } };
if (query) {
filter.$text = { $search: query };
}
if (category) filter.category = category;
if (minPrice) filter.price = { ...filter.price, $gte: minPrice };
if (maxPrice) filter.price = { ...filter.price, $lte: maxPrice };
if (color) filter.colors = color;
if (size) filter.sizes = size;
const products = await db.products
.find(filter)
.sort({ rating: -1, sales: -1 })
.limit(5)
.toArray();
return products.map(p => ({
id: p.id,
name: p.name,
price: p.price,
colors: p.colors,
sizes: p.sizes,
rating: p.rating,
image: p.images[0]
}));
}Order Processing
javascript
const orderTools = [
{
type: 'function',
function: {
name: 'add_to_cart',
description: 'Add product to cart',
parameters: {
type: 'object',
properties: {
productId: { type: 'string' },
size: { type: 'string' },
color: { type: 'string' },
quantity: { type: 'number' }
},
required: ['productId', 'size', 'color']
}
}
},
{
type: 'function',
function: {
name: 'view_cart',
description: 'View current cart contents'
}
},
{
type: 'function',
function: {
name: 'create_order',
description: 'Create order from cart',
parameters: {
type: 'object',
properties: {
customerName: { type: 'string' },
phone: { type: 'string' },
address: { type: 'string' },
courier: { type: 'string' },
paymentMethod: { type: 'string' }
},
required: ['customerName', 'address']
}
}
}
];
async function createOrder(userId, orderData) {
const cart = await getCart(userId);
if (!cart || cart.items.length === 0) {
return { success: false, message: 'Cart kosong' };
}
// Calculate totals
const subtotal = cart.items.reduce((sum, item) =>
sum + item.price * item.quantity, 0
);
const shipping = calculateShipping(orderData.address, orderData.courier);
const total = subtotal + shipping;
// Check free shipping
const freeShipping = subtotal >= 200000 && isJabodetabek(orderData.address);
const finalTotal = freeShipping ? subtotal : total;
// Create order
const order = {
orderId: generateOrderId(),
oderId
userId,
customerName: orderData.customerName,
phone: orderData.phone || userId.replace('@s.whatsapp.net', ''),
address: orderData.address,
items: cart.items,
subtotal,
shipping: freeShipping ? 0 : shipping,
total: finalTotal,
courier: orderData.courier || 'jne',
paymentMethod: orderData.paymentMethod || 'transfer',
status: 'pending_payment',
createdAt: new Date(),
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000)
};
await db.orders.insertOne(order);
await clearCart(userId);
return {
success: true,
order: {
orderId: order.orderId,
items: order.items,
subtotal: order.subtotal,
shipping: order.shipping,
total: order.total,
paymentMethod: order.paymentMethod,
expiresAt: order.expiresAt
}
};
}Payment Handling
javascript
async function handlePaymentConfirmation(userId, imageBuffer) {
// 1. Analyze payment proof with Vision AI
const analysis = await analyzePaymentProof(imageBuffer);
if (!analysis.isValid) {
return `Maaf kak, bukti transfernya kurang jelas π
Pastikan:
- Screenshot dari aplikasi banking
- Nominal dan tanggal terlihat jelas
- Bukan foto screen (kualitas rendah)
Bisa kirim ulang kak?`;
}
// 2. Find matching order
const pendingOrders = await db.orders.find({
oderId
userId,
status: 'pending_payment',
total: { $gte: analysis.amount * 0.99, $lte: analysis.amount * 1.01 }
}).toArray();
if (pendingOrders.length === 0) {
return `Hmm, aku tidak menemukan order dengan nominal Rp ${analysis.amount.toLocaleString()}.
Bisa kasih tau nomor ordernya kak?`;
}
const order = pendingOrders[0];
// 3. Update order status
await db.orders.updateOne(
{ orderId: order.orderId },
{
$set: {
status: 'paid',
paidAt: new Date(),
paymentProof: {
amount: analysis.amount,
bank: analysis.bank,
date: analysis.date,
reference: analysis.reference
}
}
}
);
// 4. Send confirmation
return `β
Pembayaran Dikonfirmasi!
Order #${order.orderId}
π° Rp ${analysis.amount.toLocaleString()}
π¦ ${analysis.bank}
Pesanan akan segera kami proses dan kirim!
Estimasi kirim: ${getEstimatedShipDate()}
Terima kasih sudah belanja di [BRAND]! π`;
}Order Tracking Integration
javascript
async function handleTrackingQuery(userId, message) {
// Find user's orders
const orders = await db.orders.find({
oderId
userId,
status: { $nin: ['delivered', 'cancelled'] }
}).sort({ createdAt: -1 }).limit(3).toArray();
if (orders.length === 0) {
return `Kak, tidak ada pesanan aktif saat ini.
Mau belanja? Ketik KATALOG untuk lihat produk! ποΈ`;
}
let response = `π¦ Status Pesanan Kakak:\n\n`;
for (const order of orders) {
response += `#${order.orderId}\n`;
response += `Status: ${getStatusEmoji(order.status)} ${formatStatus(order.status)}\n`;
if (order.trackingNumber) {
const tracking = await trackShipment(order.trackingNumber, order.courier);
response += `Posisi: ${tracking.currentLocation}\n`;
response += `Estimasi: ${tracking.estimatedDelivery}\n`;
}
response += `\n`;
}
response += `Ketik nomor order untuk detail lebih lengkap!`;
return response;
}
function getStatusEmoji(status) {
const emojis = {
pending_payment: 'β³',
paid: 'β
',
processing: 'π¦',
shipped: 'π',
out_for_delivery: 'π',
delivered: 'β
'
};
return emojis[status] || 'β';
}Complete Conversation Example
π€: Hai, mau cari dress buat kondangan
π€: Hai Kak! π Mau cari dress kondangan ya!
Aku punya beberapa rekomendasi nih:
1οΈβ£ *Dress Brukat Elegan*
π° Rp 350.000
π¨ Navy, Maroon, Black
β 4.9/5 (Best seller!)
2οΈβ£ *Midi Dress Satin*
π° Rp 425.000
π¨ Dusty Pink, Champagne
β 4.8/5
3οΈβ£ *A-Line Dress Floral*
π° Rp 299.000
π¨ Sage, Cream
β 4.7/5
Mau lihat detail yang mana kak?
---
π€: Yang nomor 1, ada size M ga?
π€: Dress Brukat Elegan size M? Ada kak! β
π Detail Produk:
- Bahan: Brukat premium + furing
- Size M: LD 90cm, Panjang 100cm
- Warna tersedia: Navy, Maroon, Black
Stok size M:
- Navy: 5 pcs β
- Maroon: 3 pcs β
- Black: 2 pcs β
Mau order yang warna apa kak?
---
π€: Navy dong, 1 aja
π€: Siap kak! Aku tambahin ke keranjang:
π Keranjang:
- Dress Brukat Elegan
- Size M, Navy
- 1 pcs
- Rp 350.000
Mau checkout sekarang atau tambah produk lain?
---
π€: Checkout aja
π€: Oke kak! Untuk checkout, aku butuh:
1οΈβ£ Nama lengkap penerima
2οΈβ£ Alamat lengkap (dengan kode pos)
3οΈβ£ No. HP penerima (jika beda)
Boleh diisi kak? π
---
π€: Dina Pratiwi, Jl. Sudirman No. 123, Jakarta Selatan 12190
π€: Terima kasih kak! Aku rangkum ordernya:
π KONFIRMASI ORDER
ββββββββββββββββββββ
π€ Dina Pratiwi
π Jl. Sudirman No. 123
Jakarta Selatan 12190
ποΈ Items:
- Dress Brukat Elegan M Navy x1
Rp 350.000
π° Subtotal: Rp 350.000
π Ongkir: GRATIS! π
ββββββββββββββββββββ
π΅ TOTAL: Rp 350.000
Pembayaran:
π¦ Transfer ke BCA 1234567890 a/n [BRAND]
Sudah benar kak? Reply OK untuk konfirmasi!
---
π€: OK
π€: β
ORDER BERHASIL!
π Order #ORD-20260217-001
Silakan transfer Rp 350.000 ke:
π¦ BCA 1234567890
π a/n [BRAND]
β° Batas bayar: 24 jam
πΈ Setelah transfer, kirim bukti ke sini ya!
Terima kasih sudah belanja di [BRAND]! πBest Practices
DO β
- Complete product info
- Clear pricing
- Easy checkout flow
- Payment verification
- Proactive shipping updates
- Quick complaint resolutionDON'T β
- Hidden fees
- Complicated ordering
- Slow payment confirm
- No tracking updates
- Ignore complaints
- Over-promise deliveryFAQ
Berapa conversion rate yang bagus?
10-20% dari inquiry ke order. Dengan AI yang baik bisa 25-30%.
Perlu integrasi marketplace?
Optional tapi recommended. Sync stock dari Tokopedia/Shopee untuk accuracy.
Kesimpulan
E-commerce AI Bot = 24/7 Sales Team!
| Manual | AI Bot |
|---|---|
| Limited hours | 24/7 |
| 1 CS = 50 chats | 1 Bot = unlimited |
| Inconsistent | Consistent |