almeira-web/read_webhook.js

28 lines
816 B
JavaScript

// Using native fetch
async function readWebhook() {
const apiUrl = process.env.EVOLUTION_API_URL || 'https://evolution.almeira.com.co';
const apiKey = process.env.EVOLUTION_API_KEY || 'mgXxu2eAwyhWNnptFEouUE6qLkvwVm6K';
const instance = process.env.EVOLUTION_INSTANCE_NAME || 'AutomataAlmeira';
console.log("Leyendo el Webhook en Evolution API...");
try {
const response = await fetch(`${apiUrl}/webhook/find/${instance}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'apikey': apiKey
}
});
const data = await response.json();
console.log("Respuesta:", JSON.stringify(data, null, 2));
} catch (e) {
console.error("Fallo:", e.message);
}
}
readWebhook();