feat: bot WhatsApp Business API — Palmas360 inicial

This commit is contained in:
Lizandro Guarnizo
2026-06-04 13:35:23 -05:00
commit 202a263e25
18 changed files with 2100 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
require('dotenv').config();
const express = require('express');
const app = express();
// Parsear JSON raw para poder verificar firma HMAC de Meta
app.use(
express.json({
verify: (req, _res, buf) => {
req.rawBody = buf;
},
})
);
// ─── Rutas ───────────────────────────────────────────────────────────────────
const wpWebhook = require('./admin/v1/wp-webhook');
app.use('/admin/v1/wp-webhook', wpWebhook);
// Health check
app.get('/health', (_req, res) => res.json({ status: 'ok', service: 'bot-palmas360' }));
// 404
app.use((_req, res) => res.status(404).json({ error: 'Ruta no encontrada' }));
// ─── Inicio ───────────────────────────────────────────────────────────────────
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`✅ Servidor corriendo en puerto ${PORT}`);
console.log(`📡 Webhook WhatsApp → /admin/v1/wp-webhook`);
});