Un script tag. Sin dependencias. Sin configuración compleja. Embeds un chat widget completamente funcional en tu sitio en menos de 3 minutos.
<script
src="https://agentflowhub.com/widget.js"
data-agent-id="mi-agente-id"
data-token="wt_yyyyyyyyyy..."
data-title="Soporte"
data-color="#e41414"
async
></script>Un script tag es todo lo que necesitas. Sin npm, sin bundlers.
Define los dominios autorizados y bloquea el resto automáticamente.
Control total desde JS: open(), close(), onMessageReceived, onOpen.
Colores, tema, posición, mensaje de bienvenida. Encaja con tu marca.
Del registro al widget embebido sin fricciones.
Un solo POST crea tu organización y devuelve el orgId y apiKey que necesitas para todo lo demás.
Respuesta
{
"org": {
"id": "org_a1b2c3d4",
"apiKey": "afhub_xxxxxxxx...",
"plan": "starter",
"maxWidgets": 3
}
}curl -X POST https://agentflowhub.com/api/orgs \
-H "Content-Type: application/json" \
-d '{
"name": "Acme Corp",
"email": "hola@acme.com",
"plan": "starter"
}'Asocia el widget a tu agente de IA y define los dominios que pueden usarlo.
Respuesta
{
"widget": {
"id": "wgt_11223344",
"token": "wt_yyyyyyyyyy...",
"remaining": 2
}
}curl -X POST https://agentflowhub.com/api/orgs/org_a1b2c3d4/widgets \
-H "X-Api-Key: afhub_xxxxxxxx..." \
-H "Content-Type: application/json" \
-d '{
"name": "Chat de soporte",
"agentId": "mi-agente-id",
"allowedOrigins": "https://acme.com"
}'Una sola línea antes del </body>. Cero dependencias, cero configuración extra.
<script
src="https://agentflowhub.com/widget.js"
data-agent-id="mi-agente-id"
data-token="wt_yyyyyyyyyy..."
data-title="Soporte Acme"
data-color="#e41414"
async
></script>Control total desde JavaScript — abre/cierra el chat, escucha eventos, integra con tu UI.
<script src="https://agentflowhub.com/widget.js" async></script>
<script>
window.addEventListener('load', function () {
const chat = window.AgentFlowhub.init({
agentId: 'mi-agente-id',
token: 'wt_yyyyyyyyyy...',
host: 'https://agentflowhub.com',
title: 'Soporte Acme',
color: '#e41414',
theme: 'dark',
onOpen: function () { console.log('chat abierto'); },
onMessageReceived: function (msg) { console.log('respuesta:', msg); },
});
// Conectar a tu propio botón de soporte
document.getElementById('btn-soporte').addEventListener('click', function () {
chat.open();
});
});
</script>Todos los parámetros del script tag y su equivalente en la API JS.
data-agent-id—Requerido. ID del agentedata-token—Requerido. Widget token (wt_...)data-titleAsistenteNombre en la cabecera del chatdata-subtitleEn líneaSubtítulodata-welcomeBienvenido...Mensaje inicialdata-color#e41414Color principal (hex)data-themelightlight o darkdata-positionrightright, left, centerdata-auto-openfalseAbrir automáticamenteEmpieza gratis. Escala cuando lo necesites.
Respuestas estandarizadas para un manejo de errores predecible.
—Faltan name, email o agentIdWIDGET_TOKEN_INVALIDToken inválido o expiradoPLAN_LIMITAlcanzaste el límite de widgets del planWIDGET_ORIGIN_FORBIDDENDominio no está en allowedOriginsWIDGET_AGENT_MISMATCHEl agentId no coincide con el token—Ya existe una org con ese emailRATE_LIMITDemasiadas solicitudes (global)PLAN_DAILY_LIMITLímite diario de mensajes agotadoPOST /api/orgs→ obtienes orgId + apiKeyPOST /api/orgs/:id/widgets→ obtienes token (wt_...)Pega el <script> en tu web→ listo ✓Sin tarjeta de crédito. Sin configuración compleja. Tu widget de IA en 3 minutos.