integration-webhooks
What it does
This skill explains how to handle incoming messages from chat and email integrations on serverless hosts. The webhook saves the work, replies at once, and a separate run does the slow agent work. It is for developers adding messaging integrations.
When to use it
- βWhen you are adding a new messaging integration such as Slack or WhatsApp.
- βWhen messages from a webhook are being dropped or answered twice.
- βWhen an agent reply takes longer than the platform's response window.
Skill link
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/integration-webhooks/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βCan you connect our app to Slack so questions in a channel get answered without timing out?β
5 new skills a week. 1 minute to read.
How it works
The webhook stores the incoming message in the database and returns a success response right away. A separate run then processes the message, and the database remains the source of truth.
Technical content (original SKILL.md)
Original text by the author, straight from 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 |
|---|
FAQ
Why not run the agent inside the webhook?
The skill says messaging platforms expect a fast reply, and an agent run can take much longer.
What about duplicate messages?
Storing each event first helps prevent a retried event from triggering a second run.
What is a self-fired request?
It is a follow-up HTTP request the app sends to itself, so the slow work runs in a fresh execution.
Details
Original description by the author
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
Popularity
- GitHub stars
- 7.6k
- Ranking position
- #13164
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
design-exploration
7.6kHelps your agent explore several UI design directions side by side, let you pick one, and then refine the chosen design.
visual-edit
7.6kHelps your agent open a running local app in a visual editor so you can review and edit its real screens together.
turn-into-app
7.6kTurns a workflow, spreadsheet or project into a polished visual app, with populated screens and an agent working behind the controls.
visual-plan
7.6kTurns a plain text plan into an interactive visual plan with diagrams, file maps, code snippets and open questions.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.