How TDL-Based WhatsApp Automation Works in Tally
TDL-based WhatsApp automation in Tally has three layers. A TDL file adds buttons and save-time hooks to Tally screens. A COM bridge passes the exported file and phone number out of Tally. A Windows service, in TallyWhatsApp's case, holds the QR-linked WhatsApp session and queues each message. A TDL alone cannot send WhatsApp.
This explainer opens up the machinery behind a WhatsApp button in Tally. It is written for accountants, Tally partners and IT staff who want to understand what each part does before installing anything. For the product itself, see the TallyPrime to WhatsApp TDL product page.
What can a TDL do, and what can it not do?
TDL is Tally Definition Language, the language TallyPrime itself is written in, and Tally's developer reference explains that user TDL files load alongside Tally's default definitions as one program. That makes TDL ideal for changing what Tally shows and does.
A TDL can add buttons to a voucher screen, react when a voucher is saved, read ledger fields such as the mobile number, and export a voucher as a PDF. What it cannot do is hold a network session with WhatsApp, run a background queue, or retry a failed delivery an hour later.
That limit is why every working Tally-to-WhatsApp tool pairs TDL with an outside program. For example, TallyPrime's own WhatsApp feature relies on Tally's online service and Interakt, while a desktop add-on relies on a local Windows service.
What are the three layers of TDL WhatsApp automation?
| Layer | Where it runs | Job | In TallyWhatsApp |
|---|---|---|---|
| 1. TDL hooks | Inside Tally | Buttons, save events, reading party data, PDF export | tallywhatsapp.tdl, loaded through tally.ini |
| 2. COM bridge | Inside the Tally process | Passes phone numbers, file path, message data and voucher ID out of Tally | A registered .NET COM class, called with Exec COM Interface |
| 3. Local service | Windows background service | WhatsApp session, outbox queue, templates, retries, safety checks | The TallyWhatsApp service and tray dashboard |
Each layer can fail independently, so knowing which layer owns a symptom is the fastest way to fix it.
What does the TDL layer do when you press Alt+J?
A form hook is a TDL modification that adds behaviour to one of Tally's existing screens without replacing it. The TallyWhatsApp TDL hooks voucher forms such as Sales, Receipt and Credit Note, and adds a Send WhatsApp button plus a Send To button to each one.
When the key is pressed, the TDL identifies the party ledger, reads its mobile number, collects values such as the voucher number, date, amount and balance, and exports the voucher through Tally's own print engine. It also checks e-invoice status, so a document is not sent without its QR code by accident.
The keys follow a simple rule: Alt+J on most vouchers, Alt+S on receipts, payments and journals, Alt+L for ledgers, Alt+N for a ledger to a chosen number, Alt+U for outstanding, and Alt+W for Send To or bulk WA Selected in the Day Book.
Why is a COM bridge needed?
COM is Microsoft's Component Object Model, a long-standing standard for letting one Windows program call another, documented on Microsoft Learn. TDL supports calling registered COM classes, and Tally documents the COM Interface definition and Exec COM Interface action on its COM DLL support in TDL page.
TallyWhatsApp's bridge is a small .NET Framework class that receives the phone numbers, the PDF path, the message data, the voucher type, a stable voucher ID and the company identity, and then forwards them to the local service over an authenticated loopback connection that never leaves the PC.
The voucher ID works as an idempotency key, which means the same voucher is not queued twice by accident. The bridge also uses a short timeout, so Tally stays responsive even if the service is busy.
What does the local Windows service do?
The service is where WhatsApp communication actually happens: it holds the QR-linked session, fills message templates, and stores every job in a local outbox database before delivery.
- Queue and retries: jobs survive restarts and network drops, and are delivered when the connection returns.
- Safety checks: randomised spacing, a check that the number is on WhatsApp, optional quiet hours, and a pause after repeated errors.
- Profiles: different Tally companies can be mapped to different WhatsApp numbers on one PC.
- Self-repair: every two minutes it confirms the COM registration and the
tally.inientry, so a TallyPrime installed later is picked up automatically. - Hub and Spoke: on the Gold plan, Spoke PCs forward documents over the LAN to one Hub that holds the session.
How does the TDL handle e-invoices and multiple companies?
Two details separate a production TDL from a demo. First, e-invoices: the TallyWhatsApp TDL checks whether e-invoicing applies to the company and whether the voucher already has its IRN, the reference issued by the system described on the GST e-invoice portal. If the IRN is missing, it warns before sending, so the customer never receives a PDF without the signed QR code by accident.
Second, companies: every call carries the company's GUID and name through the COM bridge, so the service can route each company to its own WhatsApp profile, and companies that are not explicitly enabled in F11 do nothing at all.
How do you tell which layer has a problem?
- No button on the voucher: a TDL-layer issue, so check the file under F1, TDLs and Add-Ons, as described in Tally's TDL management help, and confirm the company is enabled in F11, F6.
- "Connector is missing or outdated" message: a COM-layer issue, so run Repair and restart Tally.
- Queued but never delivered: a service-layer issue, so open the dashboard and check the WhatsApp connection status.
Our troubleshooting guide expands on each case with additional diagnostic steps.
Is TDL automation safe for your Tally data?
The TallyWhatsApp TDL reads vouchers and ledgers and exports documents; its own settings are stored as fields on the company so they persist per company. It also restores Tally's print settings after each export, so your normal printing is unaffected.
As with any add-on, test on a backup company first. WhatsApp's responsible use guidelines apply to whatever the service sends, so keep automation to documents your customers expect.
Where should you go next?
If TDL is new to you, read our TallyPrime TDL basics guide. Developers can follow the TDL code walkthrough for a Send WhatsApp button, and anyone ready to try it can use the free WhatsApp TDL download.
Frequently asked questions
Can a TDL file send WhatsApp messages by itself?
No. TDL controls Tally's screens, reports and exports. It needs an outside program to hold a WhatsApp session, and calls it through a COM interface.
Does the TDL change my company data?
The TallyWhatsApp TDL reads vouchers and ledgers and exports documents. Its settings are stored as company fields, and it does not alter your entries.
Can I run this on several PCs in one office?
Yes. With the Gold plan, each PC runs the TDL and sends through one Hub PC that holds the WhatsApp session.
Where is my data stored?
On your PC. Exported files, the message queue and the WhatsApp session all live locally. See the privacy policy for details.
See the three layers working together
Try TallyWhatsApp free for 14 days on your Windows PC, with every feature unlocked, including Gold multi-PC mode. No card needed.