CourseWhatsApp Automation for Business
ModuleSetup
Duration8 min
Progress0/7
Course material0/7 · 0%
  1. 1What we are building, and the project setup8 min
  2. 2Connecting to the WhatsApp Cloud API12 min
  3. 3Sessions and the order flow state machine12 min
  4. 4The mini CRM: contacts, orders, and labels10 min
  5. 5Payments in chat with the Midtrans sandbox12 min
  6. 6Hardening: dedupe, retries, and human takeover10 min
  7. 7Deploying with Docker, off the laptop for good12 min

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=module
Four commands: a folder, a package.json, three dependencies, and ES modules enabled.

Step 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 committed
Six small files carry the whole system. Create them empty now; we fill them lesson by lesson.

Step 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=3000
Secrets live here and only here. Add .env to .gitignore before your first commit.

Checkpoint: 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.

Related Etzal serviceWhatsApp AI chatbotPrefer it done for you? See how we help.
What we are building, and the project setup - WhatsApp Automation for Business | Etzal Academy | Etzal Group