Track AI agent costs and decisions via webhooks and WhatsApp digests
Ready for 3.0What this workflow does
This workflow has 16 nodes and runs when an HTTP POST request hits its webhook URL (plus 2 other triggers). Along the way it connects WhatsApp Business Cloud.
How it runs
Trigger: When an HTTP POST request hits its webhook URL (plus 2 other triggers).
- Ledger Config (Edit Fields (Set)): sets 6 fields: runBudgetUsd, maxEntries, maxRuns…
- Report Config (Edit Fields (Set)): sets 4 fields: digestWindowHours, recentLimit, whatsappBusinessPhoneId…
- Validate and Price Events (Code): runs custom JavaScript code
- Build Ledger Report (Code): runs custom JavaScript code
- If: checks a condition and branches into true / false
- If: checks a condition and branches into true / false
- Append to Ledger (Code): runs custom JavaScript code
- Respond with Validation Error (Respond to Webhook): sends the response back to the webhook caller
- Respond with Ledger Report (Respond to Webhook): sends the response back to the webhook caller
- Send Daily Digest via WhatsApp (WhatsApp Business Cloud): send
…plus 3 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (7)
- Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Respond to Webhook
n8n-nodes-base.respondToWebhook - WhatsApp Business Cloud
n8n-nodes-base.whatsApp - Schedule Trigger
n8n-nodes-base.scheduleTrigger
From the author
Quick overview This workflow exposes webhooks to record AI agent events (LLM calls, tool calls, decisions, and errors), calculates estimated cost from token usage, stores a persistent execution ledger in n8n static data, and sends WhatsApp alerts and daily…