Skip to content

Instantly share code, notes, and snippets.

// Ejemplo de Servidor Node.js para WhatsApp + Gemini
const axios = require('axios');
const { GoogleGenAI } = require('@google/genai');
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
// Endpoint para el Webhook de WhatsApp
app.post('/webhook', async (req, res) => {
const msg = req.body.entry[0].changes[0].value.messages[0];
const from = msg.from; // Teléfono del cliente
// Ejemplo de Servidor Node.js para WhatsApp + Gemini
const axios = require('axios');
const { GoogleGenAI } = require('@google/genai');
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
// Endpoint para el Webhook de WhatsApp
app.post('/webhook', async (req, res) => {
const msg = req.body.entry[0].changes[0].value.messages[0];
const from = msg.from; // Teléfono del cliente