How rausahankumar/tally-talk works
TallyTalk turns Telegram transaction descriptions into validated, user-confirmed TallyPrime vouchers. The main path is webhook security and parsing, AI extraction, deterministic draft validation and clarification, GST and posting-readiness checks, preview and explicit confirmation, then deterministic voucher posting. Separately, a manual/startup master-data sync populates the cache used by verification. SQLite also stores conversation state and an append-only audit log. The map follows documented behavior and shown imports; some sync and callback internals were not excerpted, so uncertain links are omitted.
Main entry points: handleMessage.js Message workflow · webhook.js Webhook security and routing · handleCallback.js Confirm and cancel · server.js Server wiring
Components 24
Application and channel
- Server wiring
src/server.js - HTTP application
src/app.js - Webhook security and routing
src/channels/telegram/webhook.js - Telegram client
src/channels/telegram/client.js
Conversation workflow
- Draft extraction
src/llm/client.js - Message workflow
src/conversation/handleMessage.js - Clarification
src/conversation/clarification.js - Preview and replies
src/conversation/messages.js - Confirm and cancel
src/conversation/handleCallback.js
Verification and GST
- Draft validation
src/validation/validateDraft.js - Refresh and resolution
src/tally/masterResolutionRefresh.js - GST and posting readiness
src/gst/postingReadiness.js - GST treatment and states
src/gst/treatment.js
Tally integration
- Master-data synchronization
src/tally/fullSync.js - Tally XML client
src/tally/client.js - Master cache
src/tally/cache.js - Voucher posting
src/tally/posting.js - Voucher XML generation
src/tally/postingXml.js
Persistence and audit
- SQLite schema and stores
src/db/schema.js - Conversation state
src/conversation/store.js - Append-only audit log
src/audit/log.js
Other components
- Telegram user
- Telegram service
- TallyPrime
Connections 29
- Telegram user → Telegram service: sends update
README.md - Telegram service → Webhook security and routing: delivers update
README.md - Webhook security and routing → Message workflow: routes text
src/channels/telegram/webhook.js - Webhook security and routing → Confirm and cancel: routes callback
src/channels/telegram/webhook.js - Message workflow → Draft extraction: extracts draft
src/conversation/handleMessage.js - Message workflow → Refresh and resolution: resolves draft
src/conversation/handleMessage.js - Refresh and resolution → Draft validation: validates draft
src/tally/masterResolutionRefresh.js - Refresh and resolution → GST and posting readiness: checks readiness
src/tally/masterResolutionRefresh.js - GST and posting readiness → GST treatment and states: determines treatment
src/gst/postingReadiness.js - GST and posting readiness → Master cache: reads masters
src/gst/postingReadiness.js - Message workflow → Clarification: resolves replies
src/conversation/handleMessage.js - Message workflow → Preview and replies: builds responses
src/conversation/handleMessage.js - Message workflow → Conversation state: stores draft
src/conversation/handleMessage.js - Message workflow → Telegram client: sends replies
- Confirm and cancel → Voucher posting: posts confirmed voucher
src/conversation/handleCallback.js - Confirm and cancel → Preview and replies: builds outcome
src/conversation/handleCallback.js - Confirm and cancel → Telegram client: sends outcome
src/conversation/handleCallback.js - Voucher posting → Voucher XML generation: generates XML
src/tally/posting.js - Voucher posting → TallyPrime: imports voucher
README.md - Master-data synchronization → Tally XML client: requests masters
src/tally/fullSync.js - Master-data synchronization → Master cache: replaces cached masters
src/tally/fullSync.js - Tally XML client → TallyPrime: sends XML requests
src/tally/client.js - Server wiring → Master-data synchronization: runs startup sync
src/server.js - Server wiring → HTTP application: creates application
src/server.js - HTTP application → Webhook security and routing: mounts route
src/app.js - Server wiring → SQLite schema and stores: opens database
src/server.js - Conversation state → SQLite schema and stores: uses schema
src/conversation/store.js - Append-only audit log → SQLite schema and stores: uses schema
src/audit/log.js - Webhook security and routing → Append-only audit log: records events
src/channels/telegram/webhook.js