Issues with the module route. The second option does not work; only the first one works

:bullseye: What is your goal?

To pass the second option in a module route, since I am using Google Sheets.

document.addEventListener(‘DOMContentLoaded’, function() {
const webhookUrl = ‘https://hook.us2.make.com/mhjj…’;

// Funct
async function track(eventLabel, targetUrl, isExternal) {
    console.log("Try:", eventLabel);
    const data = {
        evento: eventLabel,
        timestamp: new Date().toISOString(),
        pageUrl: window.location.href,
        fbclid: new URLSearchParams(window.location.search).get('fbclid') || "no_fbclid"
    };

    // Send asinc
    fetch(webhookUrl, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(data),
        keepalive: true
    }).catch(err => console.error("Error:", err));

    // Redirec
    if (isExternal) {
        window.open(targetUrl, '_blank');
    } else {
        window.location.href = targetUrl;
    }
}

// Listener 
const btnDonar = document.getElementById('btn-donar');
if (btnDonar) {
    btnDonar.addEventListener('click', function(e) {
        e.preventDefault();
        track('click_donacion', 'https://www.g....ndme.com......', true);
    });
} else {
    console.error("Not found btn-donar");
}

// Listener WhatsApp
const btnWhatsApp = document.getElementById('btn-whatsapp');
if (btnWhatsApp) {
    btnWhatsApp.addEventListener('click', function(e) {
        e.preventDefault();
        track('click_whatsapp', btnWhatsApp.href, true);
    });
} else {
    console.error("Not found btn-whatsapp");
}

});

Could someone help me, please? Thanks.

:thinking: What is the problem & what have you tried?

In Make, I used the Router module for two paths. The first path works, but the second one does not. Here is the logic: on a landing page, I have two buttons that open a blank window to another site. One redirects to an external page, and the other to WhatsApp. The purpose of the webhook is to handle the scenario where a user wants to view the content (Path 1) but has a question, so they return to the landing page to click the WhatsApp button.

:clipboard: Error messages or input/output bundles

document.addEventListener(‘DOMContentLoaded’, function() {
const webhookUrl = ‘https://hook.us2.make.com/mhjj164fpuhqglijbwnhuuap8rjkmved’;

// Función unificada
async function track(eventLabel, targetUrl, isExternal) {
    console.log("Intentando rastrear:", eventLabel);
    const data = {
        evento: eventLabel,
        timestamp: new Date().toISOString(),
        pageUrl: window.location.href,
        fbclid: new URLSearchParams(window.location.search).get('fbclid') || "no_fbclid"
    };

    // Enviamos el dato asíncronamente
    fetch(webhookUrl, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(data),
        keepalive: true
    }).catch(err => console.error("Error en el envío:", err));

    // Redirección
    if (isExternal) {
        window.open(targetUrl, '_blank');
    } else {
        window.location.href = targetUrl;
    }
}

// Listener para Donar (Se cambió el último parámetro a 'true' para abrir en nueva pestaña)
const btnDonar = document.getElementById('btn-donar-remesa');
if (btnDonar) {
    btnDonar.addEventListener('click', function(e) {
        e.preventDefault();
        track('click_donacion', 'https://www.gofundme.com/f/la-remesa-tu-esfuerzo-completo-saldras-adelante', true);
    });
} else {
    console.error("NO SE ENCONTRÓ EL BOTÓN btn-donar-remesa");
}

// Listener para WhatsApp
const btnWhatsApp = document.getElementById('btn-whatsapp-remesa');
if (btnWhatsApp) {
    btnWhatsApp.addEventListener('click', function(e) {
        e.preventDefault();
        track('click_whatsapp', btnWhatsApp.href, true);
    });
} else {
    console.error("NO SE ENCONTRÓ EL BOTÓN btn-whatsapp-remesa");
}

});

:link: Create public scenario page

https://us2.make.com/public/shared-scenario/FIx2tbITls6/integration-webhooks

The first thing to establish is whether the second event reaches Make at all, because the router can only fail on something it actually receives.

Open the scenario History and look for a run that belongs to a WhatsApp click. If there is no run for it, the problem sits on the page and not in the router. You can confirm that in a minute by sending one request to the same webhook URL by hand, with a body that carries evento set to click_whatsapp and the other four fields filled with anything. If that run appears and the second route does what it should, the scenario is fine and the click handler is what needs attention.

If the run does exist, open it, look at the webhook output bundle first and at the filter on the second route second. Three things are worth checking there.

A webhook in Make only passes the fields that belong to its data structure. If that structure was determined from an early request that did not contain evento, the field never shows up in the bundle and every filter comparing it stays false. Press Redetermine data structure on the webhook, send one WhatsApp click, then look at the bundle again.

The filter on the second route should be Text, Equal to, with evento mapped on the left side and click_whatsapp typed on the right. The comparison is case sensitive, and a trailing space in the typed value is easy to miss.

A router in Make sends the bundle down every route whose filter passes, not only the first one that matches. So if the first route also runs on a WhatsApp click, that route carries no filter at all, and giving both routes an explicit filter keeps each event in exactly one place. Also make sure the second route is not set as a fallback route, since a fallback only runs when no other route matched.