${hookUrl}
const WebhooksUI = { webhooks: [], agents: [], pipelines: [], async load() { try { const [webhooks, agents, pipelines] = await Promise.all([ API.webhooks.list(), API.agents.list(), API.pipelines.list(), ]); WebhooksUI.webhooks = Array.isArray(webhooks) ? webhooks : []; WebhooksUI.agents = Array.isArray(agents) ? agents : []; WebhooksUI.pipelines = Array.isArray(pipelines) ? pipelines : []; WebhooksUI.render(); } catch (err) { Toast.error(`Erro ao carregar webhooks: ${err.message}`); } }, filter(searchText) { const search = (searchText || '').toLowerCase(); const filtered = WebhooksUI.webhooks.filter((w) => { const name = (w.name || '').toLowerCase(); return !search || name.includes(search); }); WebhooksUI.render(filtered); }, render(filteredWebhooks) { const container = document.getElementById('webhooks-list'); if (!container) return; const webhooks = filteredWebhooks || WebhooksUI.webhooks; if (webhooks.length === 0) { container.innerHTML = `
Crie webhooks para disparar agentes ou pipelines via HTTP.
${hookUrl}