AutomationFlowsAI & RAG › AI Token Tracker for Whatsapp & Telegram – Save AI Usage to Google Sheets

AI Token Tracker for Whatsapp & Telegram – Save AI Usage to Google Sheets

Original n8n title: 📊 AI Token Tracker for Whatsapp & Telegram – Save AI Usage to Google Sheets

ByAmanda Benks @amanda on n8n.io

Hi! I'm Amanda — I create smart, useful AI automations for n8n and Make. This workflow helps you monitor how many tokens are consumed per conversation with AI Agent Tokens, and logs that usage into Google Sheets — so you can track expenses and make smarter decisions about your…

Webhook trigger★★★★★ complexityAI-powered37 nodesGmail ToolAirtable ToolGoogle SheetsGoogle Calendar ToolTelegramAgentHTTP RequestOpenAI
AI & RAG Trigger: Webhook Nodes: 37 Complexity: ★★★★★ AI nodes: yes Added:

This workflow corresponds to n8n.io template #3963 — we link there as the canonical source.

This workflow follows the Agent → Airtabletool recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "aeYhwC8OyRGijiTb",
  "name": "\ud83d\udcca AI Token Tracker for WhatsApp & Telegram \u2013 Save AI Usage to Google Sheets",
  "tags": [
    {
      "id": "mhx5MJAkz32rJgeQ",
      "name": "iloveflows.com",
      "createdAt": "2025-05-09T14:28:31.509Z",
      "updatedAt": "2025-05-09T14:28:31.509Z"
    }
  ],
  "nodes": [
    {
      "id": "bbfc6da2-6c99-4907-b46f-a32df9308aef",
      "name": "Send Email",
      "type": "n8n-nodes-base.gmailTool",
      "disabled": true,
      "position": [
        660,
        280
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "3e402e46-f5f9-432f-bee1-9b7c5f98c2b4",
      "name": "Get Contacts",
      "type": "n8n-nodes-base.airtableTool",
      "disabled": true,
      "position": [
        760,
        280
      ],
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "36d8be2b-76a9-4ee1-b42e-185d867552e8",
      "name": "Log",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1160,
        0
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "54800e58-3348-4ea7-b1f2-f3b330441add",
      "name": "Create Event",
      "type": "n8n-nodes-base.googleCalendarTool",
      "disabled": true,
      "position": [
        860,
        280
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "ce41257e-356f-4b7a-b92e-90a766a29ce5",
      "name": "Clean Up",
      "type": "n8n-nodes-base.code",
      "position": [
        1020,
        0
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "a91da594-54cc-4bba-83ae-db4a3d5a6aa6",
      "name": "Errors",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1160,
        280
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "431a8770-0a6b-4d63-ad40-2be04216ebdc",
      "name": "Error Response",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1720,
        280
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "b649cc8a-4814-4730-a18a-ed3a40c79701",
      "name": "Response",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1720,
        0
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "e86b5d5d-05a2-46f9-82a7-1fca39ec88ce",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        -120
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4277b9b8-2be1-4e7a-a89e-e446287007df",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -120
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "540d74a0-e4e8-426d-b39f-5553ffd8d203",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        180
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f8fdc426-f97e-4d51-affe-7443b368d3a5",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        180
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1bb5794e-82ff-4d59-a640-db42fd043604",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        -120
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "13b54670-f5c8-4ffd-b746-0f3a8e5301d2",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        180
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "46aa0a5e-719f-4e15-9723-60a02bdc82c8",
      "name": "Clean_Up",
      "type": "n8n-nodes-base.code",
      "position": [
        1020,
        280
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "e48dbb12-ddd1-4891-84b2-5afbfe5eab28",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1320,
        -120
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e7435546-bbc0-4d9c-9e11-23f882cb0077",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueErrorOutput",
      "position": [
        580,
        -20
      ],
      "parameters": {},
      "typeVersion": 1.9
    },
    {
      "id": "07cf1d5a-7f4f-4827-bf33-fa4deca0fb8b",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1220,
        -120
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "eafbda63-9d18-4c5b-8528-ec6f99b6d513",
      "name": "Evolution API",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -620,
        80
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "631e3652-49d3-4a53-8f8f-44baab5fc4fb",
      "name": "GET Media",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -20,
        -20
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "85ae2fa7-17af-408f-9c98-03ca6e8c8e57",
      "name": "Sticky Note19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        -120
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4a23d554-a01f-4eed-9325-01a9d8464279",
      "name": "Sticky Note20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -120
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3195e145-a460-40b0-92e4-aba90f60ee42",
      "name": "Audio or Text Separation",
      "type": "n8n-nodes-base.if",
      "position": [
        -240,
        0
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "73ec0645-70f4-40d2-abe2-14a64dc1bcff",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        120,
        -20
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "8f4c5346-4a0f-4f48-b2a7-00863d7305db",
      "name": "Audio Transcription",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        260,
        -20
      ],
      "parameters": {},
      "typeVersion": 1.6
    },
    {
      "id": "b338cf7b-1a87-4a66-8b20-e20357dc81fd",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -620,
        260
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "30d66342-6afb-4bc6-801e-b04359204feb",
      "name": "Sticky Note21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        180
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "72bd6f8f-ebad-4f38-8028-520fb76d6f6c",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        260,
        280
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "733a7a45-b428-4bc9-806b-16a08749e8eb",
      "name": "Text Mapping",
      "type": "n8n-nodes-base.set",
      "position": [
        -20,
        280
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "96e1ec07-f9d5-4d7f-93ba-fb20b94fec6e",
      "name": "Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        500,
        300
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c0b0c08a-01f5-4c18-a4f4-c930e3bfc6ed",
      "name": "Input Source",
      "type": "n8n-nodes-base.switch",
      "position": [
        1340,
        -20
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "96279412-1dad-4af2-a327-280f9cd8e866",
      "name": "Map",
      "type": "n8n-nodes-base.set",
      "position": [
        -480,
        80
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "614e597e-e7a5-4296-be51-d3b9649d00f8",
      "name": "Map1",
      "type": "n8n-nodes-base.set",
      "position": [
        -480,
        260
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "be1d7967-70bd-403b-8d1f-7b3949ae7deb",
      "name": "WhatsApp",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1560,
        -80
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "c6cb3ba8-0655-405d-b440-563f2c7f2de6",
      "name": "WhatsApp Erro",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1560,
        200
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "a375dd86-192c-4bc8-b62f-d92a17c6d0c2",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1320,
        180
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "bd7b5899-0060-4cf9-a776-486c94186124",
      "name": "Input Source1",
      "type": "n8n-nodes-base.switch",
      "position": [
        1340,
        260
      ],
      "parameters": {},
      "typeVersion": 3.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d3370083-c273-4631-83e3-9df174874430",
  "connections": {
    "Log": {
      "main": [
        [
          {
            "node": "Input Source",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map": {
      "main": [
        [
          {
            "node": "Audio or Text Separation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map1": {
      "main": [
        [
          {
            "node": "Text Mapping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Errors": {
      "main": [
        [
          {
            "node": "Input Source1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Clean Up",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Clean_Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Up": {
      "main": [
        [
          {
            "node": "Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean_Up": {
      "main": [
        [
          {
            "node": "Errors",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram": {
      "main": [
        [
          {
            "node": "Map1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET Media": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send Email": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Event": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Contacts": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Input Source": {
      "main": [
        [
          {
            "node": "WhatsApp",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Mapping": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evolution API": {
      "main": [
        [
          {
            "node": "Map",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input Source1": {
      "main": [
        [
          {
            "node": "WhatsApp Erro",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Audio Transcription",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio Transcription": {
      "main": [
        [
          {
            "node": "Text Mapping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio or Text Separation": {
      "main": [
        [
          {
            "node": "GET Media",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Text Mapping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Hi! I'm Amanda — I create smart, useful AI automations for n8n and Make. This workflow helps you monitor how many tokens are consumed per conversation with AI Agent Tokens, and logs that usage into Google Sheets — so you can track expenses and make smarter decisions about your…

Source: https://n8n.io/workflows/3963/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Are you drowning in daily operational chaos, desperately trying to juggle sales, projects, content, and client communication? Imagine an AI brain that handles it all, freeing you to lead your business

Telegram Trigger, Telegram, OpenAI +13
AI & RAG

Universal Expense tracker. Uses telegram, httpRequest, openAi, googleSheets. Webhook trigger; 33 nodes.

Telegram, HTTP Request, OpenAI +7
AI & RAG

Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI Chat +9
AI & RAG

Telegram Trigger receives incoming messages (text, voice, photo, document). Switch routes by message type to appropriate processors: Text → forwarded as-is. Voice → downloaded and sent to Transcribe a

Memory Buffer Window, Telegram Trigger, Telegram +12
AI & RAG

Transform your Telegram messenger into a powerful, multi-modal personal or team assistant. This n8n workflow creates an intelligent agent that can understand text, voice, images, and documents, and ta

Memory Buffer Window, Telegram Trigger, Telegram +10