reply / select values under a short reference so the exact value round-trips back to your handler when a user taps.
Quick Start
1
Zero-config on Telegram
TelegramBot already shares one store between its renderer and inbound registry โ a long reply value round-trips back to your agent exactly.2
Plug your own store
Implement
CallbackPayloadStoreProtocol (put / get) with any backend and pass the same instance to both the registry and the renderer.How It Works
The renderer stores overflowing values before send; the registry resolves the reference on click. Encoding only kicks in when the inline payload would overflow the channel cap.Configuration
InMemoryCallbackPayloadStore is a bounded, zero-dependency, per-process store. It purges expired entries on every put and evicts oldest-inserted (FIFO) once full.
API surface
Failure modes
Best Practices
Reuse one store between renderer and registry
Reuse one store between renderer and registry
References only resolve when the same store instance backs both sides. A mismatch means
put and get never meet, so taps silently drop.Prefer a durable backend for long-running bots
Prefer a durable backend for long-running bots
The in-memory store is per-process and clears on restart. Back it with Redis or SQLite when references must survive restarts or span multiple workers.
Keep callback values short when you can
Keep callback values short when you can
The store is a safety net, not a substitute โ short inline values skip the round-trip entirely and resolve faster.
Set max_entries to bound memory
Set max_entries to bound memory
Raise
max_entries for very large menus so live references are not evicted before users tap; lower it to cap memory on constrained hosts.Related
Interactive Bot Actions
Wire button and select-menu clicks to your own handlers
Message Presentation
Build reply and select prompts agents send to chat
Bot Presentations
Adapt presentations to each channelโs limits
Telegram Durable Approval
Approvals that survive restarts on Telegram

