Library / Finance, Invoices & Accounting
Finance, Invoices & Accounting
Log Expenses and Invoices from Chat Messages with OpenAI
When a webhook receives a chat message or image, an OpenAI agent checks whether it is an expense or invoice, records it in Google Sheets and replies.
What it does
## Prompt en Check relevance: If the text is not an expense record or invoice, immediately stop all processing. If it is bookkeeping-related, extract the six data fields below. Extract these six pieces of information: 1. Date (All numbers. If the input only says “today”, use {{ $now.format('YYYY-MM-DD') }}) 2. Channel (Free text from the input) 3. Channel Type (Must be exactly one of: Convenience Store, Personal Care Store, Hypermarket / Supermarket, Traditional Market, Online Shopping, Pharmacy, Hardware Store, Restaurant / Food, Stall, Medical Clinic / Hospital, 3C / Electronics Mall, Airline / Passenger Transport, Software Top-Up, Gas / Transit Top-Up, Online Course, Telecom Company) 4. Expense Description (Free text from the input) 5. Amount 6. Category (Must be exactly one of: Household, Main Meals, Drinks & Desserts, Household Items, Beauty, Clothing & Accessories, Transport, Entertainment, Telecom, Medical, 3C, Software, Learning, Travel) Output format: JSON :{\"Date\": \"...\", \"Channel\": \"...\", \"Channel Type\": \"...\", \"Expense Description\": \"...\", \"Amount\": \"...\", \"Category\": \"...\"}" ## Prompt zh 分析出資訊: 先判斷是否為記帳相關明細、發票,若不是則不需要處理,直接停止所有流程。若是記帳相關,分析出六個資訊: 1. 日期(如果只提到'今天',用{{ $now.format('YYYY-MM-DD') }} ) 2. 通路 3. 通路類型(只能為:便利商店、個人用品店、量販超市、傳統市場、網路購物、藥局、五金百貨、餐廳小吃店、醫療院所、3C商場、航空客運、軟體儲值、加油交通儲值、線上課程、電信公司)4. 花費明細 5. 金額 6. 類別(只能為:家用、正餐飲食、飲料甜點、生活用品、美妝、衣服飾品、交通、娛樂、電信、醫療、3C、軟體、學習、旅遊)。若通路類型判斷為航空客運,類別一定為旅遊。若無法判斷或沒資訊,請填入'DN',每格都要有資料。請輸出為 JSON 格式,例如:{\"日期\": \"...\", \"通路\": \"...\", \"通路類型\": \"...\", \"花費明細\": \"...\", \"金額\": \"...\", \"類別\": \"...\"}"
The steps
- Webhook
- message
- image
- AI Agent
- OpenAI Chat Model
- reply_to_line
- Get row(s) in sheet
- Merge_all
- reply_to_line_duplicated
- reply_to_line_no_spending
- Structured Output Parser
- append_to_sheet1
- Aggregate
- deduplication
17 steps in total.
Similar automations
Finance, Invoices & AccountingExtract Expenses from Emailed Receipts into Google Sheets6 stepsFinance, Invoices & AccountingTrack Expenses by Siri Voice with AI and Sheets9 stepsFinance, Invoices & AccountingExtract Emailed Receipt Expenses into Sheets with Mindee16 stepsFinance, Invoices & AccountingTrack Expenses in Google Sheets with an OpenAI Agent9 steps