{"product_id":"track-ai-agent-costs-decisions-with-webhooks-whatsapp-alerts","title":"Track AI Agent Costs \u0026 Decisions with Webhooks + WhatsApp Alerts","description":"\u003ch3\u003eTrack AI Agent Costs \u0026amp; Decisions in Real Time—With Webhooks + WhatsApp Alerts\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow receives webhook events from your AI agents, calculates estimated spend from token usage and pricing, stores a persistent execution ledger, and alerts you on WhatsApp when a run exceeds your budget—plus a daily digest of activity and costs.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLogs agent events via Webhook (POST):\u003c\/strong\u003e Send one event or a batch of LLM\/tool\/decision\/error events to the workflow.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates events and estimates cost:\u003c\/strong\u003e For each event, it computes cost from input\/output token counts and configured model pricing, or uses an explicit USD cost (with optional tool cost).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAppends to a persistent execution ledger:\u003c\/strong\u003e The priced events are stored in \u003cem\u003en8n workflow static data\u003c\/em\u003e, including per-run summaries and retention limits (max entries\/runs).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReturns a JSON webhook response:\u003c\/strong\u003e The caller receives how many events were recorded and the updated run totals.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWhatsApp budget alerts per run:\u003c\/strong\u003e If a run exceeds the configured per-run budget and an alert hasn’t been sent yet for that run, it sends a WhatsApp message.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGenerates ledger reports (GET):\u003c\/strong\u003e A GET webhook returns a JSON ledger report filtered by run ID, agent, time window, and limit.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDaily 24-hour digest:\u003c\/strong\u003e A scheduled run builds a 24-hour cost\/activity summary and sends it via WhatsApp.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eMonitor costs for multi-step AI agents and tool calls across environments.\u003c\/li\u003e\n  \u003cli\u003eGet instant WhatsApp notifications when a run’s spend crosses a per-run budget.\u003c\/li\u003e\n  \u003cli\u003eProduce on-demand JSON reports for audits, debugging decisions, or performance review.\u003c\/li\u003e\n  \u003cli\u003eSend a daily “what happened and how much it cost” summary to your team.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes\/blocks:\u003c\/strong\u003e \u003ccode\u003eif\u003c\/code\u003e, \u003ccode\u003eset\u003c\/code\u003e, \u003ccode\u003ecode\u003c\/code\u003e, \u003ccode\u003ewebhook\u003c\/code\u003e, \u003ccode\u003ewhats app\u003c\/code\u003e, and \u003ccode\u003esticky note\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eIntegrations:\u003c\/strong\u003e WhatsApp Business credentials (WhatsApp phone number ID + recipient phone number).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCore feature:\u003c\/strong\u003e Persistent ledger stored in n8n workflow static data with retention enforcement.\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003e\u003cstrong\u003ePerfect for:\u003c\/strong\u003e n8n users, automation engineers, and SaaS operators who need visibility into AI agent spend, decisions, and errors.\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46146294546611,"sku":"N8N-20257","price":66.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/ZcKxwP8XwCCt_xeoo5WLY_bFS4n8C4.png?v=1790845783","url":"https:\/\/buyflowscripts.com\/products\/track-ai-agent-costs-decisions-with-webhooks-whatsapp-alerts","provider":"N8N Commerce","version":"1.0","type":"link"}