Dec 3rd, 2025: [EN] Build a Conversational Expense Assistant Using Elasticsearch Agent Builder with Telegram, n8n, and AWS Bedrock

Ever wished you could talk to your expense data?

Ask things like:

  • “How much did I spend last week?”
  • “Show my food expenses for the month.”
  • “Add yesterday’s dinner for 350 via credit card.”

This project turns those natural messages, even voice notes, into structured data and searchable insights using:

  • Telegram as your chat UI
  • n8n as the workflow orchestrator
  • AWS Bedrock (Claude 3.5 Sonnet) used in this demo for intent classification, ingestion, and conversational query agents (you can replace it with any LLM of your choice)
  • Sarvam Speech-to-Text used for voice transcription (feel free to plug in Whisper, Deepgram, AssemblyAI, or something that is confortable.)
  • Elasticsearch Agent Builder + MCP handles storage, semantic search, and custom ES|QL function-calling tools.

Also, prepared a single Colab notebook that deploys the entire n8n workflow automatically, and it is temporary. For sustained n8n servers, please feel free to deploy it on your servers instead of Colab.


What This System Does

  • Converts voice → text

  • Determines whether the message is:

    • INGEST (“Spent 250 on lunch”)
    • QUERY (“What did I spend last month?”)
  • Ingests structured JSON into Elasticsearch with semantic embeddings

  • Uses Agent Builder tools to run contextual ES|QL queries

  • Sends friendly answers back in Telegram

  • Handles low-confidence classification with an interactive clarification step


n8n Architecture at a Glance

Flow:

Telegram → n8n (STT → Classifier → Ingest/Query routing) → AWS Bedrock LLMs → Elasticsearch (index + semantic search using MCP) → Elastic Agent Builder tools → Telegram response


Key Nodes/Components

n8n Workflow

  • Telegram Trigger

  • Voice/Text switch

  • STT request

  • Classifier agent

  • Ingestion agent

  • Query agent via Agent Builder MCP

  • Elasticsearch indexer

  • Low-confidence gates

Elasticsearch

  • Enabling semantic_text field with Bedrock embeddings

  • Clean index mapping (amount, merchant, category, ts/@timestamp, raw_transcript.)

  • Agent Builder tools built with ES|QL

AWS Bedrock

  • Claude 3.5 Sonnet v2 for:

  • Intent classification

  • Expense JSON extraction

  • Query agent reasoning (function calling via MCP)


Try It Yourself (One-Click Setup)

I packaged everything inside this Colab notebook:

Colab:

https://colab.research.google.com/gist/someshwaranM/b5d21d51a6a9a9cc96e62b05c97ac203/som-expense-tool-colab.ipynb

What the Colab does for you:

  • Spins up n8n inside Colab for a Temporary setup.

  • Exposes it to the internet via Cloudflare Tunnel

  • Creates AWS, ES, Telegram credentials in n8n via API

  • Installs the entire workflow template

  • Sets up Elasticsearch:

  • Bedrock inference endpoint

  • Index mapping with semantic_text

  • Provides a bulk ingest tool for your synthetic expense dataset

  • Lets you start chatting with your bot immediately from Telegram.


Demo Screenshots

  • Telegram conversation

  • Agent Builder (Direct Conversation)

  • Elastic Agent Builder Youtube Video

Wrap-Up

This stack gives you:

  • A conversational personal finance assistant

  • Full semantic + structured search using Elastic Agent Builder

  • Real-time ingestion from chat or voice


1 Like