{"slug": "event-triggers-bn-garudust", "title": "Event Triggers บน Garudust", "summary": "The article explains that Garudust uses a single core primitive, `agent.run(task)`, to handle all event triggers, including chat messages, cron jobs, and webhooks, by converting external HTTP POST requests into tasks. It details the technical implementation, such as using an Axum HTTP server, HMAC-SHA256 signature verification for security, and asynchronous processing that returns a `202 Accepted` response. The article also provides concrete use cases, including email processing, GitHub Actions workflows, monitoring jobs, and calendar integrations, where external systems handle filtering and task creation while Garudust manages agent execution and result handling via callback URLs.", "body_md": "core ของ Garudust เปิดเผย primitive พื้นฐานตัวเดียว: agent.run(task)\nทุก entry point — ไม่ว่าจะเป็นข้อความจากแชท, cron job, หรือ webhook call — ล้วนลงเอยที่ call เดียวกันนี้ทั้งสิ้น นั่นหมายความว่าระบบภายนอกใดก็ตามที่ส่ง HTTP POST ได้ ก็สามารถเป็น event trigger ให้ Garudust ได้เลย\nบทความนี้จะอธิบายว่ามันทำงานอย่างไรในปัจจุบัน, pattern ที่ใช้งานได้จริงใน production และ use case ที่เป็นรูปธรรม\nเมื่อ Garudust ถูกตั้งค่าให้ใช้ webhook platform มันจะเปิด Axum HTTP server และลงทะเบียน POST endpoint ไว้ที่ path ที่คุณกำหนด request ขาเข้าจะมีหน้าตาแบบนี้:\n{\n\"text\": \"A new billing invoice has arrived from Acme Corp for $4,200.\",\n\"callback_url\": \"https://your-system.example.com/garudust/reply\",\n\"user_id\": \"billing-watcher\",\n\"session_key\": \"billing-acme-corp\"\n}\nGarudust จะห่อข้อมูลนี้เป็น InboundMessage\n, ส่งผ่าน GatewayHandler\n, spawn agent.run()\nขึ้นมา และเมื่อ agent ทำงานเสร็จก็จะ POST คำตอบกลับไปที่ callback_url\n:\n{\n\"text\": \"Invoice from Acme Corp for $4,200 — categorised as SaaS/Infrastructure. Flagged for approval above $3,000 threshold. Draft approval request sent to #finance.\"\n}\nHTTP response ที่ตอบกลับ POST ของคุณทันทีคือ 202 Accepted\n— agent ทำงานแบบ asynchronous\nGarudust ตรวจสอบ HMAC-SHA256 signature ทุก request ที่เข้ามา ตั้ง shared secret ใน config แล้ว sign ทุก POST ขาออกด้วย:\nX-Hub-Signature-256: sha256=<hex(HMAC-SHA256(secret, raw_body))>\nRequest ที่ไม่มี signature ถูกต้องจะถูกปฏิเสธด้วย 401\nและ callback URL ที่ชี้ไป private IP (192.168.x.x\n, 10.x.x.x\n, localhost\n) ก็ถูก block โดย network guard ด้วย — agent ไม่สามารถถูกบังคับให้ call back หา internal infrastructure ได้\nการแบ่งหน้าที่ชัดเจนมาก:\nระบบภายนอก Garudust\n───────────────── ──────────────────────────\nEvent source (email, → Webhook adapter\ncalendar, DB, queue)\nFilter / match logic → โค้ดของคุณ (ก่อน POST)\nTask description → agent.run(task)\nResult handling → handler ที่ callback_url ของคุณ\nระบบของคุณเป็นเจ้าของ filter — Garudust เป็นเจ้าของการรัน agent ทั้งสองฝั่งไม่จำเป็นต้องรู้โครงสร้างภายในของกันและกันเลย\nบริการประมวลผลอีเมลคอยดักจับอีเมลจากผู้ส่งที่เป็นระบบ billing เมื่อเจออีเมลที่ match ก็ดึง subject, ผู้ส่ง และจำนวนเงิน แล้ว trigger Garudust:\n{\n\"text\": \"New invoice received: Stripe — $1,840 for May 2026. Attach to this month's expense report and notify the finance channel if it exceeds the $1,500 alert threshold.\",\n\"callback_url\": \"https://your-ops.example.com/hooks/garudust\",\n\"session_key\": \"finance-inbox\"\n}\nAgent ใช้ tool ของมันอ่านไฟล์ expense report, เพิ่ม line item และโพสต์แจ้ง Slack บริการอีเมลทำแค่ match ผู้ส่งแล้วยิง — ไม่ต้องรู้อะไรเกี่ยวกับ expense report หรือ Slack เลย\nGitHub Actions workflow เรียก Garudust หลังมี PR เปิดเข้ามาที่ branch main\nโดย workflow สร้าง payload จาก GitHub context:\n{\n\"text\": \"PR #214 opened by @alice: 'feat: add OAuth2 PKCE flow'. Changed files: src/auth/oauth.rs, src/auth/pkce.rs, tests/auth_integration.rs. Diff summary attached. Review for security issues in the auth flow and post a summary comment.\",\n\"callback_url\": \"https://your-ci.example.com/garudust/pr-review\",\n\"session_key\": \"pr-214\"\n}\nwebhook ของ GitHub ยิง workflow → workflow สร้าง task text → Garudust รีวิว และ session_key\nที่ผูกกับเลข PR ทำให้ trigger ครั้งถัดไป (commit ใหม่, ขอรีวิวซ้ำ) ต่อเนื่องใน conversation thread เดิม\nMonitoring job query ฐานข้อมูลตามตาราง schedule แล้วตรวจ aggregate metric เมื่อ metric ข้ามเกณฑ์ แทนที่จะส่ง static alert มันยิง Garudust แทน:\n{\n\"text\": \"Anomaly detected: orders table insert rate dropped 94% in the last 10 minutes (baseline 340/min, current 19/min). Last successful insert: 09:42 UTC. Investigate root cause and summarise for on-call.\",\n\"callback_url\": \"https://ops.example.com/garudust/incidents\",\n\"session_key\": \"incident-2026-05-23-orders\"\n}\nAgent สามารถใช้ terminal หรือ database tool รัน query เพิ่มเติม, ตรวจ deploy ล่าสุด และสรุป incident แบบมีโครงสร้าง — monitoring job ทำแค่ตรวจ threshold breach เท่านั้น\nIntegration layer poll Google Calendar (หรือรับ push notification) แล้วยิง Garudust เมื่อมี event ถูกสร้างขึ้นพร้อม attendee ที่ domain ไม่ตรงกับองค์กรของคุณ:\n{\n\"text\": \"New calendar event: 'Q3 partnership discussion' on 2026-06-04 14:00 UTC. External attendees: jane@partner.com, bob@partner.com. Prepare a one-page briefing on Partner Corp using the CRM notes and recent email thread.\",\n\"callback_url\": \"https://your-system.example.com/garudust/calendar\",\n\"session_key\": \"meeting-prep-2026-06-04\"\n}\nCalendar integration เป็นเจ้าของ logic กรอง \"external attendee\" — Garudust เป็นเจ้าของการสร้าง briefing\nBackground worker ดึงงานออกจาก task queue (SQS, Redis, RabbitMQ) แล้วส่งแต่ละชิ้นให้ Garudust ทำ เหมาะกับงานที่ปริมาณผันแปรและต้องการให้ agent จัดการแต่ละชิ้นในแบบของตัวเอง:\n{\n\"text\": \"Customer support ticket #8821 (priority: high): User reports that export to CSV silently truncates rows above 10,000. Reproduce the scenario, identify the code path responsible, and draft a fix description for the engineering team.\",\n\"callback_url\": \"https://support.example.com/garudust/tickets\",\n\"session_key\": \"ticket-8821\"\n}\nQueue worker dequeue, จัดรูป task text, ยิง webhook หลาย ticket สามารถรันเป็น concurrent agent session พร้อมกันได้\nsession_key\nคือสิ่งที่ทำให้ event trigger มีประโยชน์เกินกว่างานแบบ one-shot เมื่อคุณตรึง key ไว้ webhook call ทั้งหมดที่ใช้ key เดียวกันจะแชร์ conversation history ร่วมกัน หมายความว่า:\nถ้าต้องการแยก session ออกจากกันสมบูรณ์ (แต่ละ event เป็นอิสระ) ก็ไม่ต้องระบุ session_key\n— Garudust จะใช้ callback_url\nเป็น key แทน ทำให้ได้ context ใหม่ต่อ callback target ที่ไม่ซ้ำกัน\nWebhook adapter คือ push target — ระบบภายนอกต้องเป็นฝ่ายเริ่มการเชื่อมต่อ ถ้าต้องการให้ Garudust ดึงข้อมูลจากแหล่งต้นทางเอง (ตรวจ inbox, poll API, เฝ้าดูไฟล์) โดยไม่ต้องมี scheduler นั้นต้องใช้ cron job ที่คอย poll หรือรอ primitive watch\n/filter\nที่ยังไม่มีในปัจจุบัน\nสำหรับ use case ที่เป็น push-based จริงๆ (GitHub webhook, queue worker, calendar push notification, email routing service) สถาปัตยกรรมปัจจุบันรองรับได้ครบและการแบ่งหน้าที่ก็ชัดเจนดีอยู่แล้ว", "url": "https://wpnews.pro/news/event-triggers-bn-garudust", "canonical_source": "https://dev.to/garudust/event-triggers-bn-garudust-4ji3", "published_at": "2026-05-23 03:24:03+00:00", "updated_at": "2026-05-23 03:31:07.794230+00:00", "lang": "en", "topics": ["developer-tools", "enterprise-software", "cloud-computing"], "entities": ["Garudust", "Axum", "Acme Corp", "HMAC-SHA256"], "alternates": {"html": "https://wpnews.pro/news/event-triggers-bn-garudust", "markdown": "https://wpnews.pro/news/event-triggers-bn-garudust.md", "text": "https://wpnews.pro/news/event-triggers-bn-garudust.txt", "jsonld": "https://wpnews.pro/news/event-triggers-bn-garudust.jsonld"}}