# Kharcha Tracker Workflow > n8n mein Telegram se kharcha likho, Google Sheet khud bhare: step by step Free guide by bloopcommits (@bloopcommits) · https://bloopcommits.pages.dev/budget/ Month end pe paise kahan gaye, ye yaad nahi aata? Is guide mein ek chhota n8n workflow hai: Telegram bot ko kharcha likho, jaise 'chai 20', AI usme se amount aur category nikalta hai, aur Google Sheet mein ek row apne aap judti hai. Na koi app kholna, na haath se sheet bharna. > **Ye workflow kya karta hai** > > - Tum apne Telegram bot ko message likhte ho (Telegram Trigger). > - Basic LLM Chain message padhta hai; uske neeche Gemini model sochta hai aur Structured Output Parser jawab ko fixed fields mein rakhta hai: amount, category, note. > - Google Sheets mein nayi row judti hai: date, amount, category, note. > - Telegram Send Message se bot tumhe confirmation bhejta hai, jaise 'Logged: 20 (food)'. ![n8n ke official preview mein poora workflow: New Spend > Read Spend > Gemini Model > Fixed Fields > Add Row > Send Reply](https://bloopcommits.pages.dev/budget/workflow.png) _Poora workflow, n8n ke official preview mein (workflow hamara, screen n8n ka)._ Reel mein jo 'chai 20', 'auto 60' aur Sheet ki rows dikhi, wo banaya hua example hai. Ye starter workflow hai, n8n ke official preview mein dikhaya gaya. Credentials khud jodne padte hain, aur chalu karne se pehle ek message se test zaroor karo. ## Node by node (n8n ke official docs ke hisaab se) | Node (canvas par naam) | n8n node | Kya karta hai | Tumhe kya set karna hai | | --- | --- | --- | --- | | New Spend | Telegram Trigger | Telegram ke events par workflow shuru karta hai, jaise tumhara Message. | Telegram credential (BotFather ka token). Event: Message. | | Read Spend | Basic LLM Chain | Prompt set karta hai jo model use karega, aur response ke liye optional parser. | Prompt (neeche diya hai). 'Require Specific Output Format' on, taaki output parser judey. | | Gemini Model | Google Gemini Chat Model (sub-node) | Google ke Gemini chat models ko chain mein use karta hai. | Google Gemini(PaLM) credential: API key Google AI Studio se. Model dropdown se chuno: n8n wahi models dikhata hai jo tumhare account ko available hain. | | Fixed Fields | Structured Output Parser (sub-node) | JSON Schema ke hisaab se fields wapas deta hai. 'Generate from JSON Example': example ke property names aur types use hote hain, values ignore hoti hain, har field mandatory. | JSON example: amount, category, note. | | Add Row | Google Sheets, Append Row | Sheet mein nayi row banata hai. | Google credential, Document + Sheet. Mapping Column Mode: Map Each Column Manually (Date, Amount, Category, Note). | | Send Reply | Telegram, Send Message | Chat mein message bhejta hai. Text ki limit 4096 characters. | Chat ID aur Text. Reply ke neeche 'Append n8n Attribution' default on hota hai; workflow mein off rakha hai. | ## Kya chahiye - n8n: apne server par self-host (Community Edition) ya n8n Cloud (free trial). Kharche ka section neeche hai. - Telegram bot ka Access Token: Telegram par BotFather se chat shuru karo, /newbot likho, naam aur username do (username 'bot' par khatam hona chahiye), aur jo token mile use n8n mein Access Token ki jagah daalo. - Ek Google account aur ek Google Sheet. Google credentials ke liye n8n docs OAuth2 recommend karte hain. n8n Cloud par Google nodes ke liye managed OAuth2 hai (saare plans par); self-host mein tumhe apna OAuth2 credential configure karna padta hai. - Google Gemini API key: Google AI Studio mein Create API Key, aur key n8n credential mein daalo. - Telegram Trigger ke liye n8n ka HTTPS URL: n8n docs likhte hain 'For Telegram, this URL must use HTTPS.' Self-host mein WEBHOOK_URL environment variable mein apne n8n ka public URL daalna padta hai. ## Sheet ke columns Google Sheet ki pehli row mein ye headers likho, bilkul isi naam se: | Date | Amount | Category | Note | | --- | --- | --- | --- | | (automatic) | 20 | food | chai | | (automatic) | 60 | travel | auto | Upar ki rows sirf banaya hua example hain: ye dikhane ke liye ki workflow ke baad Sheet kaisi dikhegi. Date workflow khud bharta hai. ## Step by step 1. n8n kholo (Cloud trial ya apna self-host) aur ek naya workflow banao. 2. Neeche wala starter workflow Import from File se laao, ya JSON copy karke canvas par paste karo. 3. Telegram Trigger, Google Gemini Chat Model, Google Sheets aur Telegram nodes mein apne credentials chuno ya naye banao. Credentials khud jodne padte hain. 4. Google Sheet banao aur pehli row mein headers likho: Date, Amount, Category, Note. 5. Add Row node mein apni sheet chuno aur dekho ki Date, Amount, Category, Note ke values bhare hain. 6. Gemini Model node mein model dropdown se ek model chuno. 7. Read Spend (Basic LLM Chain) mein prompt dekho. Chaho to categories ki list chhoti rakh ke badlo. 8. Telegram Trigger ke liye apne n8n ka HTTPS URL set karo (self-host mein WEBHOOK_URL). 9. Apne bot ko ek test message bhejo, jaise: chai 20 (banaya hua example). Dekho: Sheet mein row aayi? Bot ne 'Logged: ...' bheja? 10. Test sahi aaye, tab workflow ko chalu karo. [Workflow file download karo](https://bloopcommits.pages.dev/budget/bloopcommits-budget-workflow.json) - .json file · n8n mein Import from File · download na ho to neeche Copy dabao **starter workflow: n8n mein Import from File / paste karo, credentials khud jodo, ek message se test karo** ``` { "name": "Kharcha Tracker Starter", "nodes": [ {"id":"1","name":"New Spend","type":"n8n-nodes-base.telegramTrigger","typeVersion":1.2,"position":[0,0],"parameters":{"updates":["message"],"additionalFields":{}}}, {"id":"2","name":"Read Spend","type":"@n8n/n8n-nodes-langchain.chainLlm","typeVersion":1.6,"position":[300,0],"parameters":{"promptType":"define","hasOutputParser":true,"text":"=You split a short personal expense message into fields. Reply only in the requested format.\n- amount: the number only, no currency sign (use 0 if there is no number)\n- category: one of food, travel, study, fun, shopping, bills, other\n- note: the item in one or two words\n\nMessage: {{ $json.message.text }}"}}, {"id":"3","name":"Gemini Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","typeVersion":1,"position":[220,260],"parameters":{"options":{}}}, {"id":"4","name":"Fixed Fields","type":"@n8n/n8n-nodes-langchain.outputParserStructured","typeVersion":1.2,"position":[420,260],"parameters":{"jsonSchemaExample":"{\n \"amount\": 80,\n \"category\": \"food\",\n \"note\": \"momos\"\n}"}}, {"id":"5","name":"Add Row","type":"n8n-nodes-base.googleSheets","typeVersion":4.6,"position":[640,0],"parameters":{"operation":"append","documentId":{"__rl":true,"mode":"list","value":""},"sheetName":{"__rl":true,"mode":"list","value":""},"columns":{"mappingMode":"defineBelow","value":{"Date":"={{ $now.toFormat('dd LLL') }}","Amount":"={{ $json.output.amount }}","Category":"={{ $json.output.category }}","Note":"={{ $json.output.note }}"},"matchingColumns":[],"schema":[]},"options":{}}}, {"id":"6","name":"Send Reply","type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[940,0],"parameters":{"chatId":"={{ $('New Spend').item.json.message.chat.id }}","text":"=Logged: {{ $('Read Spend').item.json.output.amount }} ({{ $('Read Spend').item.json.output.category }})","additionalFields":{"appendAttribution":false}}} ], "connections": {"New Spend":{"main":[[{"node":"Read Spend","type":"main","index":0}]]},"Read Spend":{"main":[[{"node":"Add Row","type":"main","index":0}]]},"Gemini Model":{"ai_languageModel":[[{"node":"Read Spend","type":"ai_languageModel","index":0}]]},"Fixed Fields":{"ai_outputParser":[[{"node":"Read Spend","type":"ai_outputParser","index":0}]]},"Add Row":{"main":[[{"node":"Send Reply","type":"main","index":0}]]}} } ``` Is JSON mein credentials nahi hain, aur Sheet ka document / sheet khali hai: wo tumhe khud bharna hai. Gemini model node mein model bhi tumhe chunna hai. ## Prompt (Read Spend node ka text) **Basic LLM Chain ka prompt: categories ki list apni zarurat se chhoti rakho** ``` You split a short personal expense message into fields. Reply only in the requested format. - amount: the number only, no currency sign (use 0 if there is no number) - category: one of food, travel, study, fun, shopping, bills, other - note: the item in one or two words Message: {{ $json.message.text }} ``` Structured Output Parser ke JSON example mein amount, category aur note hain. n8n docs ke hisaab se example se bane schema mein har field mandatory hoti hai, isliye prompt mein likha hai ki number na ho to amount 0 do. > **Banaya hua example** > > - Tum likhte ho: chai 20 > - Parser se milta hai: amount 20, category food, note chai > - Sheet mein row: Date, 20, food, chai > - Bot ka reply: Logged: 20 (food) > - Tip: categories ki list chhoti rakho, jaise food, travel, study, fun. ## Aam galtiyan - Sheet ke headers aur Add Row ke naam alag hain. Column names bilkul same rakho: Date, Amount, Category, Note. - Basic LLM Chain mein 'Require Specific Output Format' on nahi kiya, ya Structured Output Parser chain se juda nahi. Parser sub-node chain ke Output Parser input se judna chahiye, Gemini model Model input se. - AI ne amount ya category galat pad li. Sheet hi final record hai: row dekhte raho, aur categories ki list chhoti rakho. - Telegram Trigger par HTTPS URL nahi hai, ya self-host mein WEBHOOK_URL set nahi hai. Telegram ke liye URL HTTPS hi hona chahiye. - Test aur production URL ke beech badalna. Telegram ek app par sirf ek webhook allow karta hai, aur test URL se production URL par (ya ulta) jaane par purana webhook overwrite ho jaata hai. - Telegram bot ka token galat hai. Token BotFather se aata hai. Reply node mein Chat ID bhi dekho. - Credentials jode hi nahi, ya galat Google account chuna. Har node mein apna credential chuno. - Test kiye bina workflow chalu kar dena. Pehle ek message se check karo. > **Privacy aur safety** > > - Kharcha haath se type karo. Bank SMS, UPI screenshot, card number ya OTP bot ko kabhi mat bhejo: wo Telegram aur AI API se guzarega. > - Free Gemini API tier par Google ke terms ke hisaab se tumhara bheja hua content aur generated responses Google ke products ko provide, improve aur develop karne mein use ho sakte hain, aur human reviewers input / output padh sakte hain. Google ka kehna hai: sensitive, confidential ya personal information Unpaid Services ko mat bhejo. Isliye private cheez mat bhejo. > - AI category galat daal sakta hai. Sheet check karte raho. > - Accounts aur credentials tumhare apne hain: bot token, Google credential aur Gemini key kisi ko share mat karo. > - Ye starter workflow hai. Ek message se test karo, phir chalu karo. > - Ye advice hai, guarantee nahi. ## Kharcha (plans badalte rehte hain, official page dekho) | Option | n8n ke official pages ke hisaab se | | --- | --- | | Self-host (Community Edition) | Free Community edition with most features. Infrastructure tum khud provide aur manage karte ho. | | n8n Cloud | Fully hosted by n8n. Free trial milta hai (Cloud trial ke liye credit card nahi chahiye). Uske baad paid plans: Starter, Pro, Business, Enterprise. | > **Yaad rakho** > > - Telegram Trigger -> Basic LLM Chain (Gemini model + Output Parser) -> Google Sheets -> Telegram Send Message. > - Kharcha haath se type karo; bank SMS, UPI screenshot, card number, OTP kabhi nahi. > - Free Gemini API par private cheez nahi. AI galat bhi ho sakta hai: Sheet check karo. > - Accounts aur credentials khud jodo; Telegram Trigger ko HTTPS URL chahiye. > - Starter workflow hai: ek message se test karo. ## Official links - [n8n docs: Telegram Trigger](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.telegramtrigger/) - [n8n docs: Telegram Trigger common issues (HTTPS, WEBHOOK_URL)](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.telegramtrigger/common-issues/) - [n8n docs: Basic LLM Chain](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainllm/) - [n8n docs: Google Gemini Chat Model](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatgooglegemini/) - [n8n docs: Structured Output Parser](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.outputparserstructured/) - [n8n docs: Google Sheets](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/) - [n8n docs: Telegram (Send Message)](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.telegram/message-operations/) - [n8n docs: Telegram credentials](https://docs.n8n.io/integrations/builtin/credentials/telegram/) - [n8n docs: Google credentials](https://docs.n8n.io/integrations/builtin/credentials/google/) - [n8n docs: Google Gemini(PaLM) credentials](https://docs.n8n.io/integrations/builtin/credentials/googleai/) - [Google: Gemini API terms](https://ai.google.dev/gemini-api/terms) - [Google: Gemini API pricing page (free tier data use)](https://ai.google.dev/gemini-api/docs/pricing) - [n8n: pricing](https://n8n.io/pricing) --- More free guides: https://bloopcommits.pages.dev/