Skip to main content

πŸ“Š AI token tracker for WhatsApp & Telegram – Save AI usage to Google Sheets

Workflow preview

Workflow preview
100%
πŸ“Š AI token tracker for WhatsApp & Telegram – Save AI usage to Google Sheets preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

GPT 4o Token Tracker – Measure AI Usage and Cost via WhatsApp or Telegram Hi! I'm Amanda β€” I create smart, useful AI automations for n8n and Make. This workflow helps you monitor how many tokens...

Best for

  • Engineering automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.gmailtool, n8n-nodes-base.airtabletool, n8n-nodes-base.googlesheets, n8n-nodes-base.googlecalendartool, n8n-nodes-base.code, n8n-nodes-base.telegram, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.agent

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Amanda Benks.

Original n8n.io source

1.1 Workflow description

Title
πŸ“Š AI token tracker for WhatsApp & Telegram – Save AI usage to Google Sheets
Workflow name
πŸ“Š AI token tracker for WhatsApp & Telegram – Save AI usage to Google Sheets

πŸ’Έ GPT-4o Token Tracker – Measure AI Usage and Cost via WhatsApp or Telegram

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 AI usage.

You can connect it to Telegram or WhatsApp (via Evolution API), and it will automatically capture:

  • Prompt and completion tokens
  • Total tokens
  • Time of interaction
  • The user/channel
  • (Optional) Cost estimate in USD

πŸ“Š What this workflow does

  • Logs token usage from LangChain agents
  • Calculates token totals for each request
  • Appends the data to a structured Google Sheet
  • Works with WhatsApp (Evolution API) or Telegram bots
  • Ideal for tracking AI Agent Tokens usage over time and controlling costs

πŸ§ͺ Free Spreadsheet Template

You can duplicate and use this template for logging token usage:
πŸ‘‰ Google Sheets Template

Includes columns like:

  • Date
  • Input
  • Output
  • Tokens (Prompt / Completion / Total)
  • Tool name or use case
  • Estimated cost

πŸ› οΈ Setup Instructions

  1. Import the workflow to your n8n (Cloud or self-hosted)
  2. Connect your Google Sheets account
  3. Choose your trigger:
    • WhatsApp (Evolution API webhook)
    • Telegram (Bot webhook or message input)
  4. Fill out:
    • AI Agent model used (e.g. gpt-4o)
    • Cost per 1K tokens (optional, for USD estimation)
  5. Update spreadsheet ID and tab name in the Google Sheets node
  6. (Optional) Connect as a sub-tool to an AI agent for automatic logging

🧰 Tech Used

  • OpenRouter
  • LangChain
  • Google Sheets
  • Telegram or WhatsApp webhook (Evolution API)
  • Nodes: HTTP Request, Set, If, Google Sheets, Merge

βœ… Who This Is For

  • Developers or agencies that want to monitor AI Agent Tokens usage
  • Freelancers managing AI bots for clients
  • Teams that need billing visibility and cost control
  • Anyone who wants transparency in AI token spending

βœ… Requirements

  • OpenAI GPT-4o access
  • Google Sheets credential
  • Telegram Bot Token (or Evolution API access for WhatsApp)
  • n8n (Cloud or self-hosted)

🌐 Want this template?

❀️ Buy more workflows at: https://iloveflows.com
☁️ Try n8n Cloud: https://n8n.partnerlinks.io/amanda

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Send Email

Type / Role
n8n-nodes-base.gmailTool - gmailTool
Config choices
Version 2.1

Block 2 - Get Contacts

Type / Role
n8n-nodes-base.airtableTool - airtableTool
Config choices
Version 2.1

Block 3 - Log

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 4 - Create Event

Type / Role
n8n-nodes-base.googleCalendarTool - googleCalendarTool
Config choices
Version 1.3

Block 5 - Clean Up

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Errors

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 7 - Error Response

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 8 - Response

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 9 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 12 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Clean_Up

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.9

Block 18 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Evolution API

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 20 - GET Media

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 21 - Sticky Note19

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note20

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Audio or Text Separation

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2

Block 24 - Convert to File

Type / Role
n8n-nodes-base.convertToFile - convertToFile
Config choices
Version 1.1

Showing the first 24 of 37 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow πŸ“Š AI token tracker for WhatsApp & Telegram – Save AI usage to Google Sheets
Complexity advanced
Nodes 37
Categories Engineering, AI Chatbot
Author Amanda Benks
Published 09 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3963/3963.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does πŸ“Š AI token tracker for WhatsApp & Telegram – Save AI usage to Google Sheets do?

GPT 4o Token Tracker – Measure AI Usage and Cost via WhatsApp or Telegram Hi! I'm Amanda β€” I create smart, useful AI automations for n8n and Make. This workflow helps you monitor how many tokens...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, AI Chatbot use case.