Langsung ke konten
Skillpedia
API & server (backend)7.6k Β· #13164

integration-webhooks

Fungsinya

Skill ini menjelaskan cara menangani pesan masuk dari integrasi obrolan dan email di host tanpa server. Webhook menyimpan pekerjaan, langsung membalas, dan run terpisah melakukan pekerjaan agent yang lambat. Skill ini untuk pengembang yang menambahkan integrasi pesan.

Kapan dipakai

  • βœ“Saat Anda menambahkan integrasi pesan baru seperti Slack atau WhatsApp.
  • βœ“Ketika pesan dari webhook hilang atau dijawab dua kali.
  • βœ“Saat balasan agent memakan waktu lebih lama daripada jendela respons platform.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/integration-webhooks/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBisakah Anda menghubungkan aplikasi kami ke Slack supaya pertanyaan di kanal dijawab tanpa batas waktu habis?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Webhook menyimpan pesan masuk ke basis data dan segera mengembalikan respons sukses. Run terpisah kemudian memproses pesan itu, dan basis data tetap menjadi sumber kebenaran.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum

Mengapa tidak menjalankan agent di dalam webhook?

Skill ini menyatakan platform pesan mengharapkan balasan cepat, sedangkan run agent bisa jauh lebih lama.

Bagaimana dengan pesan duplikat?

Menyimpan setiap peristiwa lebih dulu membantu mencegah peristiwa yang dicoba ulang memicu run kedua.

Apa itu permintaan yang dipicu sendiri?

Itu adalah permintaan HTTP lanjutan yang dikirim aplikasi ke dirinya sendiri, sehingga pekerjaan lambat berjalan dalam eksekusi baru.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
7.6k
Peringkat
#13164
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa