본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)7.6k · #13164

integration-webhooks

하는 일

이 스킬은 서버리스 호스트에서 채팅 및 이메일 연동의 들어오는 메시지를 처리하는 방법을 설명합니다. 웹훅은 작업을 저장하고 즉시 응답하며, 별도의 실행이 느린 에이전트 작업을 처리합니다. 메시징 연동을 추가하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓Slack이나 WhatsApp 같은 새 메시징 연동을 추가할 때.
  • ✓웹훅의 메시지가 누락되거나 두 번 응답될 때.
  • ✓에이전트 응답이 플랫폼의 응답 시간 제한보다 길어질 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/integration-webhooks/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“채널에서 던진 질문이 시간 초과 없이 답을 받도록, 우리 앱을 Slack에 연결해 주실 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

웹훅은 들어온 메시지를 데이터베이스에 저장하고 즉시 성공 응답을 반환합니다. 그다음 별도의 실행이 메시지를 처리하며, 데이터베이스가 기준이 되는 원본으로 남습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
자주 묻는 질문

웹훅 안에서 에이전트를 실행하면 안 되나요?

메시징 플랫폼은 빠른 응답을 기대하는데, 에이전트 실행은 훨씬 오래 걸릴 수 있다고 이 스킬은 말합니다.

중복 메시지는 어떻게 하나요?

각 이벤트를 먼저 저장하면, 재시도된 이벤트가 두 번째 실행을 시작하는 것을 막는 데 도움이 됩니다.

자가 호출 요청이란 무엇인가요?

앱이 자기 자신에게 보내는 후속 HTTP 요청입니다. 느린 작업을 새 실행에서 처리하게 합니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
7.6k
순위
#13164
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬