const express = require('express'); const path = require('path'); const botLogic = require('./botLogic'); const app = express(); const port = 3000; app.use(express.json()); app.use(express.static(path.join(__dirname, '../'))); // Serve static files from parent dir // Mock WhatsApp Webhook app.post('/whatsapp/webhook', async (req, res) => { const { from, body } = req.body; console.log(`Received message from ${from}: ${body}`); const response = await botLogic.handleMessage(from, body); // In a real app, you'd call Twilio/Meta API here to send the reply res.json({ success: true, reply: response.reply, buttons: response.buttons || [] }); }); app.listen(port, () => { console.log(`CuraFlow WhatsApp Mock Server running at http://localhost:${port}`); });