Cara Test Auto Reply WA Sebelum Aktifkan
Cara testing auto reply WhatsApp sebelum go live. Checklist, test cases, debugging. Pastikan bot berfungsi sempurna!
Jangan langsung go live tanpa testing!
Auto reply yang error bisa bikin customer bingung dan bisnis rugi. Berikut cara testing yang proper.
Kenapa Testing Penting?
❌ TANPA TESTING:
- Typo di pesan
- Keyword tidak trigger
- Logic error
- Customer dapat response salah
- Bisnis terlihat tidak profesional
✅ DENGAN TESTING:
- Semua flow berfungsi
- Pesan sudah benar
- Edge cases handled
- Siap untuk productionTesting Checklist
1. Basic Functionality
□ Bot bisa menerima pesan
□ Bot bisa mengirim reply
□ Greeting message muncul
□ Keyword trigger bekerja
□ Menu navigasi berfungsi
□ Response time acceptable2. All Keywords/Triggers
□ Setiap keyword sudah ditest
□ Variasi penulisan (lowercase, uppercase, mixed)
□ Typo umum masih bisa trigger
□ Multiple keywords dalam 1 pesan3. Flow Completeness
□ Flow dari awal sampai akhir
□ Setiap branch/pilihan
□ Back/kembali ke menu
□ Exit flow
□ Error handling4. Content Quality
□ Tidak ada typo
□ Informasi akurat
□ Link berfungsi
□ Format rapi di HP
□ Emoji display benar5. Edge Cases
□ Pesan kosong
□ Pesan sangat panjang
□ Spam messages
□ Unknown commands
□ Special characters
□ Media (gambar/file)Cara Testing
Step 1: Gunakan Nomor Test
JANGAN test dengan nomor bisnis langsung!
Options:
1. Nomor HP kedua/pribadi
2. Nomor teman/keluarga
3. WhatsApp Business Sandbox (Cloud API)
4. Emulator (untuk development)Step 2: Test Basic Flow
Test 1: Greeting
Send: "Halo"
Expected: Welcome message + menu
Test 2: Menu Selection
Send: "1"
Expected: Response untuk menu 1
Test 3: Keyword Trigger
Send: "harga"
Expected: Daftar harga
Test 4: Unknown Input
Send: "xyz123"
Expected: "Maaf, tidak dimengerti..."Step 3: Test Setiap Keyword
javascript
// Test cases untuk keyword
const testCases = [
{ input: 'harga', expected: 'contains:Rp' },
{ input: 'HARGA', expected: 'contains:Rp' },
{ input: 'Harga dong', expected: 'contains:Rp' },
{ input: 'katalog', expected: 'contains:produk' },
{ input: 'order', expected: 'contains:cara order' },
{ input: 'ongkir jakarta', expected: 'contains:JNE' },
];
async function runTests() {
for (const test of testCases) {
const response = await simulateMessage(test.input);
const passed = checkExpectation(response, test.expected);
console.log(`${test.input}: ${passed ? '✅' : '❌'}`);
}
}Step 4: Test Complete Flow
SCENARIO: Customer Order Flow
1. Send: "halo"
→ Check: Welcome message
2. Send: "1" (katalog)
→ Check: List produk
3. Send: "order kaos hitam L 2"
→ Check: Konfirmasi order
4. Send: [alamat]
→ Check: Pilihan kurir
5. Send: "1" (pilih kurir)
→ Check: Invoice
6. Send: [bukti transfer]
→ Check: Konfirmasi pembayaranStep 5: Test Edge Cases
EDGE CASE TESTS:
1. Empty message
Send: "" (kosong)
Expected: Ignore atau default response
2. Very long message
Send: [500+ karakter]
Expected: Tidak crash
3. Rapid messages
Send: 10 pesan dalam 5 detik
Expected: Handle gracefully
4. Special characters
Send: "harga <script>alert(1)</script>"
Expected: Sanitized, no injection
5. Media message
Send: [gambar]
Expected: "Untuk gambar, silakan..."Automated Testing
Unit Test untuk Bot:
javascript
const assert = require('assert');
describe('Auto Reply Bot', () => {
it('should reply greeting for "halo"', async () => {
const response = await bot.processMessage('halo');
assert(response.includes('Selamat datang'));
});
it('should show price for "harga"', async () => {
const response = await bot.processMessage('harga');
assert(response.includes('Rp'));
});
it('should handle unknown input', async () => {
const response = await bot.processMessage('xyz123random');
assert(response.includes('tidak dimengerti'));
});
it('should be case insensitive', async () => {
const r1 = await bot.processMessage('KATALOG');
const r2 = await bot.processMessage('katalog');
const r3 = await bot.processMessage('Katalog');
assert(r1 === r2 && r2 === r3);
});
});Integration Test:
javascript
describe('Order Flow', () => {
it('should complete full order flow', async () => {
const session = new TestSession();
// Step 1: Greeting
let response = await session.send('halo');
assert(response.includes('menu'));
// Step 2: Select order
response = await session.send('order kaos hitam L 1');
assert(response.includes('konfirmasi'));
// Step 3: Send address
response = await session.send('Jl. Test No. 123, Jakarta');
assert(response.includes('kurir'));
// Step 4: Select courier
response = await session.send('1');
assert(response.includes('total'));
// Order complete!
});
});Debugging Tips
1. Enable Logging
javascript
client.on('message', async msg => {
console.log('---');
console.log('From:', msg.from);
console.log('Body:', msg.body);
console.log('Type:', msg.type);
const response = await processMessage(msg);
console.log('Response:', response);
console.log('---');
});2. Check State
javascript
// Debug user state
client.on('message', async msg => {
const state = userState.get(msg.from);
console.log('Current state:', state);
// Process...
console.log('New state:', userState.get(msg.from));
});3. Test in Isolation
javascript
// Test function langsung tanpa WA
async function testProcessMessage() {
const mockMsg = {
from: '[email protected]',
body: 'harga'
};
const response = await processMessage(mockMsg);
console.log('Response:', response);
}
testProcessMessage();Pre-Launch Checklist
FINAL CHECK SEBELUM GO LIVE:
□ Semua basic tests passed
□ Semua keyword tested
□ Complete flows tested
□ Edge cases handled
□ Error messages friendly
□ Links working
□ Contact info correct
□ Spelling checked
□ Tested di real phone (bukan emulator)
□ Test dengan beberapa orang lain
□ Backup plan jika ada masalahFAQ
Berapa lama testing yang cukup?
Minimal 1-2 hari untuk bot sederhana. Lebih kompleks = lebih lama.
Perlu QA khusus?
Untuk bisnis besar, yes. Untuk UMKM, bisa test sendiri + minta teman bantu.
Kapan boleh go live?
Setelah semua test passed dan sudah test dengan real users (teman/keluarga).
Kesimpulan
Testing = Insurance for your bot!
| Phase | Action |
|---|---|
| Unit test | Test each function |
| Integration | Test complete flows |
| User test | Real people testing |
| Edge cases | Unusual scenarios |
Test thoroughly, launch confidently!