Lesson 1 / 7 · 8 min
What we are building, and the project setup
The end result, the free stack, and a running project skeleton. Checkpoint: a Node project that starts.
By the end of this course you will have a real system, not notes: a WhatsApp bot that greets customers, takes a multi-step order, records contacts and orders in a database, sends a payment link, hears the payment confirmation, and replies automatically, deployed with Docker. Every lesson ends with a checkpoint you can run.
The stack, and why it is free
- WhatsApp Cloud API (official): Meta gives every developer a free test number that can message up to 5 verified recipients. Real API, zero cost, zero ban risk.
- Node.js + Express: the webhook server. One language, no framework magic.
- SQLite (better-sqlite3): a real database in a single file, no server to install.
- ngrok: a public HTTPS tunnel to your laptop while developing.
- Midtrans sandbox (lesson 5): real payment flow, fake money.
Prerequisites
Node.js 20 or newer installed, a free Meta developer account (developers.facebook.com), and basic comfort with a terminal. You do not need prior backend experience; every file is written out in full in these lessons.
Step 1: create the project
mkdir wa-bot && cd wa-bot
npm init -y
npm install express better-sqlite3 dotenv
npm pkg set type=moduleStep 2: the file layout
wa-bot/
server.js # webhook endpoints + routing (lesson 2)
wa.js # send-message helpers (lesson 2)
db.js # SQLite tables + helpers (lesson 3)
flow.js # the order state machine (lesson 3)
pay.js # Midtrans integration (lesson 5)
.env # secrets, never committedStep 3: the .env file
WHATSAPP_TOKEN= # lesson 2: from the Meta console
PHONE_NUMBER_ID= # lesson 2: from the API Setup page
VERIFY_TOKEN=any-random-string-you-choose
MIDTRANS_SERVER_KEY= # lesson 5: sandbox server key
ADMIN_PHONE= # lesson 6: your own WhatsApp number
PORT=3000Checkpoint: run node -e "console.log('ok')" inside the folder and confirm Node answers. Project skeleton done. Next lesson we connect it to WhatsApp and send our first automated reply.
What you take away
- The outcome is a deployed order bot with payments, built lesson by lesson
- The whole stack is free: Cloud API test number, Node, SQLite, ngrok, Midtrans sandbox
- Six small files carry the system; secrets live in .env only
- Every lesson ends with a runnable checkpoint
Curated sources
Hand-picked references for going deeper, reviewed by our team.