TallyPrime Skill
Connect to a locally running TallyPrime instance and perform read/write operations via its XML-over-HTTP API. All requests are HTTP POST to $TALLY_URL (default: http://localhost:9000) with XML body.
TallyPrime must be open and running on the user's machine. There is no cloud API — all communication is local.
Company name: CAs manage multiple companies. Always get the company name from the user — either they'll mention it in their message, or ask them before proceeding. Never assume.
Hero Use Case: WhatsApp Invoice → Tally Entry (Zero Manual Entry)
The problem for CAs: You manage 10+ businesses. A client sends a purchase bill PDF on WhatsApp. You have to open Tally, find the right company, check if the vendor ledger exists, create it if not, then manually type every field. This takes 5–10 minutes per invoice.
With this skill: Client sends the PDF to your OpenClaw WhatsApp number. The agent reads the invoice, extracts all fields, checks/creates the vendor ledger, and posts the purchase voucher — in under 30 seconds.
Step-by-step Flow
CODEBLOCK0
When to Use This Skill
- - User sends a purchase invoice, bill, or receipt (PDF or image) and wants it entered in Tally
- User asks to create a sales invoice / purchase bill / payment / receipt in Tally
- User wants to check outstanding receivables or payables
- User asks for a ledger statement, day book, or trial balance
- User wants to know their GST liability for a period
- User asks "what did we buy from X vendor last month?"
- User wants to add a new ledger or group in Tally
- User wants to check if Tally is running / connected
- User mentions "book this entry", "add to Tally", "post this bill"
- User wants to reconcile vendor invoices against Tally entries
⚠️ Critical Rules (Read Before Any Operation)
- 1. Never guess ledger names. Always check if a ledger exists before using it in a voucher. If it doesn't exist, create it first.
- Never assume the company name. If the user mentions it (e.g., "for Reliance Industries" or "in ABC Traders"), use that exact name. If they don't mention it, ask: "Which company should I post this to?" before proceeding.
- Date format is
YYYYMMDD — no dashes or slashes. March 2, 2026 → 20260302. - Always include a unique
GUID when creating vouchers to prevent duplicates on retry. - Amount sign convention:
- Party/vendor entry:
AMOUNT is
negative (e.g.,
-50000),
ISDEEMEDPOSITIVE =
No for creditors
- Expense/purchase entry:
AMOUNT is
positive (e.g.,
50000),
ISDEEMEDPOSITIVE =
No
- See the voucher section for exact signs per voucher type.
- 6.
"Voucher date is missing" error = date is outside the company's configured financial year. Ask user to check Tally's company period settings. "Ledger X does not exist" error = create the ledger first, then retry the voucher.- For multi-company CAs: Always confirm which company the entry belongs to before posting.
Step 0: Check Server Status
Always verify Tally is running before any operation.
CODEBLOCK1
Expected response:
CODEBLOCK2
If connection is refused or times out, tell the user: "TallyPrime doesn't seem to be running. Please open TallyPrime on your computer and try again."
Step 1: Check If a Ledger Exists
Before creating any voucher, verify all referenced ledgers exist.
CODEBLOCK3
Parse the XML response and grep for <NAME>LEDGER_NAME</NAME> to confirm existence.
Step 2: Create a Ledger (if missing)
Use REPORTNAME=All Masters for all master creation.
CODEBLOCK4
Ledger Group Reference
| Ledger Type | Parent Group | ISDEEMEDPOSITIVE |
|---|
| Customer (debtor) | INLINECODE17 | INLINECODE18 |
| Vendor (creditor) |
Sundry Creditors |
No |
| Sales income |
Sales Accounts |
No |
| Purchase expense |
Purchase Accounts |
No |
| Bank account |
Bank Accounts |
Yes |
| Cash |
Cash-in-Hand |
Yes |
| GST Output (sales tax) |
Duties & Taxes |
No |
| GST Input (purchase tax) |
Duties & Taxes |
Yes |
| Other expense |
Indirect Expenses |
No |
| Direct cost/COGS |
Direct Expenses |
No |
Success response:
<RESPONSE><CREATED>1</CREATED><ERRORS>0</ERRORS></RESPONSE>
Step 3: Create Vouchers
Use REPORTNAME=Vouchers for all voucher creation.
3a. Purchase Voucher (Vendor Bill)
Use when: A vendor sends a bill/invoice for goods or services purchased.
Accounting entry:
- - Debit: Purchase / Expense ledger (cost increases)
- Debit: GST Input Credit ledger (if GST applicable)
- Credit: Vendor ledger (liability increases)
CODEBLOCK6
Amount signs for Purchase voucher:
- - Purchase/expense:
AMOUNT = -(base amount) → e.g., INLINECODE39 - GST Input:
AMOUNT = -(gst amount) → e.g., INLINECODE41 - Vendor (credit):
AMOUNT = +(total invoice amount) → e.g., INLINECODE43 - All amounts must balance to zero.
3b. Sales Voucher (Customer Invoice)
Use when: Business raises an invoice to a customer for goods/services sold.
CODEBLOCK7
3c. Payment Voucher (Money Paid Out)
Use when: Business pays a vendor, rent, salary, or any expense.
CODEBLOCK8
3d. Receipt Voucher (Money Received)
Use when: Business receives money from a customer.
CODEBLOCK9
3e. Journal Voucher (Adjustments / Provisions)
Use when: GST adjustments, provisions, depreciation, accruals, or any internal accounting entry.
CODEBLOCK10
Reading Data (Export Operations)
Get Day Book (All Transactions for a Period)
CODEBLOCK11
Get Balance Sheet
CODEBLOCK12
Get Trial Balance
CODEBLOCK13
Get Ledger Statement (Transactions for a Specific Ledger)
CODEBLOCK14
Full Example: WhatsApp Purchase Invoice → Tally
Scenario: Client sends a PDF invoice from "Reliance Retail Ltd." for ₹59,000 (₹50,000 base + ₹9,000 GST @ 18%), dated 15-Jan-2026, invoice no. RRL/2026/00123.
Step 1 — Extract from PDF/Image
Use your vision capability to extract:
CODEBLOCK15
Step 2 — Check & Create Ledgers
Check if these 3 ledgers exist. Create any that are missing:
| Ledger | Group | Action |
|---|
| INLINECODE44 | INLINECODE45 | Create if missing |
| INLINECODE46 |
Purchase Accounts | Create if missing |
|
GST Input Credit |
Duties & Taxes | Create if missing |
Step 3 — Post Purchase Voucher
CODEBLOCK16
Step 4 — Confirm to User
On success (CREATED=1), reply:
✅ Purchase entry booked in Tally
| Field | Value |
|---|
| Company | (as confirmed by user) |
| Vendor |
Reliance Retail Ltd. |
| Invoice No | RRL/2026/00123 |
| Date | 15 Jan 2026 |
| Base Amount | ₹50,000 |
| GST (18%) | ₹9,000 |
| Total | ₹59,000 |
The vendor ledger "Reliance Retail Ltd." was created under Sundry Creditors.
Error Handling
| Error Message | Cause | Fix |
|---|
| INLINECODE51 not returned | Tally not open | Tell user to open TallyPrime |
| INLINECODE52 |
Ledger missing | Create it via Step 2, then retry |
|
Voucher date is missing | Date outside company's FY | Ask user: "What financial year is configured in your Tally company?" |
|
The date X is Out of Range | Same as above | Same fix |
|
Could not find Report 'X' | Wrong report name | Use exact report names from this skill |
|
CREATED=0, EXCEPTIONS=1 | Generic data error | Check narration for special characters — escape
& as
& |
GUID Generation
Always generate a unique GUID per voucher to prevent duplicates. A good pattern:
CODEBLOCK17
Examples:
- - INLINECODE59
- INLINECODE60
- INLINECODE61
If the same GUID is sent twice, Tally will update the existing record instead of creating a duplicate — this makes the operation safely idempotent.
Multi-Company Workflow for CA Firms
CAs typically manage 10–50+ companies in a single Tally installation. Handle company context like this:
- 1. If the user mentions the company (e.g., "for Sharma Traders" or "in my textile client's books") — use that name directly as
SVCURRENTCOMPANY in the XML. - If the user doesn't mention it — always ask before posting: "Which company should I book this in?" Never assume.
- After posting — always confirm the company name in your reply so the user can catch any mistakes.
- If unsure about the exact Tally company name — you can fetch all available company names by querying
List of Accounts without a SVCURRENTCOMPANY filter, or simply ask the user to confirm the exact spelling as it appears in Tally.
Note: The company name in SVCURRENTCOMPANY must match exactly (case-sensitive) how it appears in Tally. Even a trailing space or different capitalisation will cause the request to fail silently or return data from the wrong company.
TallyPrime 技能
连接到本地运行的 TallyPrime 实例,并通过其基于 XML 的 HTTP API 执行读写操作。所有请求均为 HTTP POST 到 $TALLY_URL(默认值:http://localhost:9000),请求体为 XML 格式。
TallyPrime 必须在用户计算机上打开并运行。没有云 API——所有通信均为本地进行。
公司名称: CA 管理多家公司。始终从用户处获取公司名称——要么用户在消息中提及,要么在继续操作前询问用户。切勿自行假设。
核心用例:WhatsApp 发票 → Tally 录入(零手动录入)
CA 面临的问题: 您管理 10 多家企业。客户通过 WhatsApp 发送采购账单 PDF。您必须打开 Tally,找到正确的公司,检查供应商分类账是否存在,若不存在则创建,然后手动输入每个字段。每张发票需要 5–10 分钟。
使用此技能: 客户将 PDF 发送到您的 OpenClaw WhatsApp 号码。代理读取发票,提取所有字段,检查/创建供应商分类账,并在 30 秒内过账采购凭证。
分步流程
- 1. 通过 WhatsApp 接收采购发票的 PDF/图片
- 使用视觉功能提取发票字段(供应商名称、GSTIN、日期、行项目、金额、税额)
- 切换到正确的 Tally 公司(如果不明确则询问用户)
- 检查供应商分类账是否存在 → 若不存在则创建(在“应付暂记”下)
- 检查费用/采购分类账是否存在 → 若不存在则创建
- 检查 GST 分类账是否存在 → 若不存在则创建
- 过账包含所有分类账分录的采购凭证
- 向用户确认,提供凭证编号和摘要
何时使用此技能
- - 用户发送采购发票、账单或收据(PDF 或图片)并希望将其录入 Tally
- 用户要求在 Tally 中创建销售发票/采购账单/付款/收款
- 用户希望检查未结应收或应付账款
- 用户要求提供分类账报表、日记账或试算平衡表
- 用户希望了解某期间的 GST 负债
- 用户询问“上个月我们从 X 供应商处采购了什么?”
- 用户希望在 Tally 中添加新分类账或分组
- 用户希望检查 Tally 是否正在运行/已连接
- 用户提到“录入此分录”、“添加到 Tally”、“过账此账单”
- 用户希望将供应商发票与 Tally 分录进行对账
⚠️ 关键规则(任何操作前请阅读)
- 1. 切勿猜测分类账名称。 在凭证中使用分类账之前,始终检查其是否存在。若不存在,请先创建。
- 切勿假设公司名称。 如果用户提及(例如,“用于 Reliance Industries”或“在 ABC Traders 中”),请使用该确切名称。如果用户未提及,请询问:“我应该将此过账到哪家公司?” 然后再继续。
- 日期格式为 YYYYMMDD——无破折号或斜杠。2026 年 3 月 2 日 → 20260302。
- 创建凭证时始终包含唯一的 GUID,以防止重试时产生重复。
- 金额符号约定:
- 客户/供应商分录:AMOUNT 为
负数(例如 -50000),对于债权人,ISDEEMEDPOSITIVE = No
- 费用/采购分录:AMOUNT 为
正数(例如 50000),ISDEEMEDPOSITIVE = No
- 请参阅凭证部分,了解每种凭证类型的确切符号。
- 6. 凭证日期缺失 错误 = 日期超出公司配置的会计年度。请用户检查 Tally 的公司期间设置。
- 分类账 X 不存在 错误 = 先创建分类账,然后重试凭证。
- 对于多公司 CA: 在过账前始终确认该分录属于哪家公司。
步骤 0:检查服务器状态
在任何操作前,始终验证 Tally 是否正在运行。
bash
curl -s --max-time 5 $TALLY_URL
预期响应:
TallyPrime Server is Running
如果连接被拒绝或超时,请告知用户:TallyPrime 似乎未运行。请打开计算机上的 TallyPrime 并重试。
步骤 1:检查分类账是否存在
在创建任何凭证之前,验证所有引用的分类账是否存在。
bash
curl -s -X POST $TALLY_URL \
-H Content-Type: application/xml \
-d
List of Accounts
$$SysName:XML
COMPANY_NAME
解析 XML 响应并 grep 查找 LEDGER_NAME 以确认存在。
步骤 2:创建分类账(若缺失)
所有主数据创建均使用 REPORTNAME=All Masters。
bash
curl -s -X POST $TALLY_URL \
-H Content-Type: application/xml \
-d
All Masters
COMPANY_NAME
LEDGER_NAME
PARENT_GROUP
Yes
分类账分组参考
| 分类账类型 | 父级分组 | ISDEEMEDPOSITIVE |
|---|
| 客户(债务人) | Sundry Debtors | Yes |
| 供应商(债权人) |
Sundry Creditors | No |
| 销售收入 | Sales Accounts | No |
| 采购费用 | Purchase Accounts | No |
| 银行账户 | Bank Accounts | Yes |
| 现金 | Cash-in-Hand | Yes |
| GST 输出(销售税) | Duties & Taxes | No |
| GST 输入(采购税) | Duties & Taxes | Yes |
| 其他费用 | Indirect Expenses | No |
| 直接成本/COGS | Direct Expenses | No |
成功响应:
xml
10
步骤 3:创建凭证
所有凭证创建均使用 REPORTNAME=Vouchers。
3a. 采购凭证(供应商账单)
适用场景:供应商发送所购商品或服务的账单/发票。
会计分录:
- - 借方:采购/费用分类账(成本增加)
- 借方:GST 输入抵免分类账(如适用 GST)
- 贷方:供应商分类账(负债增加)
bash
curl -s -X POST $TALLY_URL \
-H Content-Type: application/xml \
-d
Vouchers
COMPANY_NAME