integration-webhooks
ما الذي تفعله
تشرح هذه المهارة كيفية معالجة الرسائل الواردة من تكاملات الدردشة والبريد على الخوادم بلا خادم. يحفظ Webhook العمل ويرد فوراً، ثم يعالج تشغيل منفصل عمل الوكيل البطيء. وهي مخصصة للمطورين الذين يضيفون تكاملات مراسلة.
متى تستخدمها
- ✓عندما تضيف تكاملاً جديداً للمراسلة مثل Slack أو WhatsApp.
- ✓عندما تُسقط الرسائل من Webhook أو يُجاب عنها مرتين.
- ✓عندما يستغرق رد الوكيل وقتاً أطول من نافذة الاستجابة للمنصة.
رابط المهارة
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/integration-webhooks/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“هل يمكنك ربط تطبيقي بـ Slack حتى تُجاب الأسئلة في القناة دون انتهاء المهلة؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يخزّن Webhook الرسالة الواردة في قاعدة البيانات، ويعيد استجابة نجاح فوراً. ثم يعالج تشغيل منفصل الرسالة، وتبقى قاعدة البيانات المصدر الموثوق للحقيقة.
المحتوى التقني (ملف 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 |
|---|
الأسئلة الشائعة
لماذا لا يُشغَّل الوكيل داخل Webhook؟
تنص المهارة على أن منصات المراسلة تتوقع رداً سريعاً، وتشغيل الوكيل قد يستغرق وقتاً أطول كثيراً.
ماذا عن الرسائل المكررة؟
تخزين كل حدث أولاً يساعد على منع الحدث المعاد إرساله من تشغيل ثانٍ.
ما الطلب الذاتي الإرسال؟
هو طلب 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
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
design-exploration
7.6kيساعد وكيلك على استكشاف عدة اتجاهات تصميم لواجهة المستخدم جنباً إلى جنب، ثم تختار أنت واحداً، ويحسّن الوكيل التصميم المختار.
visual-edit
7.6kيساعد وكيلك على فتح تطبيق محلي يعمل في محرر مرئي، لتراجع شاشاته الحقيقية وتحررها معاً.
turn-into-app
7.6kيحوّل سير عمل أو جدول بيانات أو مشروعاً إلى تطبيق مرئي مصقول، فيه شاشات مملوءة بالبيانات ووكيل يعمل خلف أدوات التحكم.
visual-plan
7.6kيحوّل خطة نصية عادية إلى خطة مرئية تفاعلية فيها مخططات وخرائط ملفات ومقتطفات كود وأسئلة مفتوحة.
مهارات مشابهة
api-connector-builder
280kيبني وكيلك اتصالات API جديدة على النمط الموجود، ويفيد عندما تحتاج إلى تكامل إضافي دون ابتكار طريقة جديدة للعمل.
api-design
280kيساعد وكيلك على تصميم واجهات REST API وفق أفضل الممارسات، ويوضح كيف تتواصل وكيف تُعرض الأخطاء وكيف تُنظَّم البيانات.
backend-patterns
280kيساعد وكيلك على أنماط بنية الخادم وتحسين قاعدة البيانات، ويفيد في بناء الشيفرة التي تعمل على الخادم أو مراجعتها.