Saltar al contenido
Skillpedia
APIs y servidores (backend)7,6 mil · #13164

integration-webhooks

Qué hace

Esta skill explica cómo gestionar mensajes entrantes de integraciones de chat y correo en hosts sin servidor. El webhook guarda el trabajo y responde al momento, y una ejecución aparte hace el trabajo lento del agente. Es para desarrolladores que añaden integraciones de mensajería.

Cuándo usarla

  • ✓Cuando añades una integración de mensajería nueva, como Slack o WhatsApp.
  • ✓Cuando los mensajes de un webhook se pierden o se responden dos veces.
  • ✓Cuando una respuesta del agente tarda más que la ventana de respuesta de la plataforma.

Link de la skill

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/integration-webhooks/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/integration-webhooks/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“¿Puedes conectar nuestra app a Slack para que las preguntas en un canal reciban respuesta sin que se agote el tiempo?”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

El webhook guarda el mensaje entrante en la base de datos y devuelve una respuesta de éxito inmediatamente. Después una ejecución aparte procesa el mensaje, y la base de datos sigue siendo la fuente de verdad.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Integration Webhooks

Rule

Integration webhooks (Slack, Telegram, WhatsApp, email, Google Docs, etc.) must enqueue work to SQL and return 200 immediately, then process the work in a separate fresh function execution kicked off by a self-fired HTTP POST. SQL is always the source of truth. Long-lived hosts use an in-process retry loop as a best-effort safety net; serverless deployments must use an external durable sweep when recovery cannot depend on a process staying alive.

Do not run agent loops inside the webhook handler itself. Do not rely on fire-and-forget Promises after returning from a serverless handler — they get killed when the function freezes.

Why

Messaging platforms expect a 200 response within a tight window — Slack will retry after 3 seconds, and a retried event triggers duplicate agent runs. At the same time, an agent loop replying to the message can take 30–60+ seconds because it may make multiple LLM calls and tool calls.

Past attempts that don't work cross-host:

  • Fire-and-forget Promise.then(...) after returning — Lambda/Vercel/CF freeze the execution context the moment the response goes out. The promise is silently killed, the user gets no reply, and there's no error in the logs.
  • A platform background function as the queue — host-specific execution is useful as a delivery mechanism, but it cannot replace the SQL row or atomic claim shared by every host.
  • Cloudflare event.waitUntil() — CF Workers only, not portable.
  • Vercel Fluid / after() — Vercel-only, gated behind specific runtimes.
  • A long-lived in-process queue — fine on a single Node box, but on serverless every cold start gets a fresh queue and any pending work is lost.

The only universal answer: persist the work, then trigger a brand new function execution to do it. SQL is the queue, a self-webhook is the trigger, and a recurring job is the safety net.

The Flow

┌──────────┐    1. POST /integrations/:platform/webhook
│ Platform │────────────────────────────────────────────►┌──────────────────┐
└──────────┘                                             │ Webhook handler  │
                                                         │ (function exec 1)│
                                                         └──────────────────┘
                                                                  │
                            2. INSERT INTO integration_pending_tasks
                                 (status='pending', payload=...)
                                                                  │
                            3. dispatch POST /integrations/process-task
                                 — portable self-fire by default
                                 — acknowledged background handoff when enabled
                                                                  │
                            4. return 200 to platform ◄───────────┘

                                                         ┌──────────────────┐
                          5. POST arrives at processor   │ Processor        │
                             (separate fresh function)   │ (function exec 2)│
                                                         └──────────────────┘
                                                                  │
                            6. claimPendingTask(id) → status='processing'
                            7. runAgentLoop(...) — full timeout budget here
                            8. adapter.sendResponse(...) back to platform
                            9. markTaskCompleted(id)


                          ┌──────────────────────────────────────────────┐
                          │  Recovery sweep (every 60s) — safety net    │
                          │  Re-fires processor for tasks stuck in       │
                          │  'pending' or 'processing' beyond timeout.   │
                          │  Caps retries at 3 then marks 'failed'.      │
                          └──────────────────────────────────────────────┘

The webhook handler does as little as possible. The fresh function execution that handles _process-task gets its own full timeout budget for the agent loop.

Key Files

File Purpose
Preguntas frecuentes

¿Por qué no ejecutar el agente dentro del webhook?

La skill indica que las plataformas de mensajería esperan una respuesta rápida, y una ejecución de agente puede tardar mucho más.

¿Qué pasa con los mensajes duplicados?

Guardar primero cada evento ayuda a evitar que un evento reintentado provoque una segunda ejecución.

¿Qué es una petición autoenviada?

Es una petición HTTP de seguimiento que la app se envía a sí misma, para que el trabajo lento se ejecute en una ejecución nueva.

Detalles

Descripción original del autor

Cross-platform pattern for handling messaging integration webhooks (Slack, Telegram, WhatsApp, email, etc.) on serverless hosts. Use when adding a new integration adapter, debugging dropped messages, or wiring long-running agent work into a webhook handler.

repo: BuilderIO/agent-native

Popularidad

Estrellas en GitHub
7,6 mil
Posición en el ranking
#13164
Licencia
MIT
Actualizada
2/11/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas