Telegram AI bot and CRM: handing a conversation to a person BYstudio, 2026-11-08 Fictional conversation handoff, BYstudio, 8 November 2026. All messages, employees and identifiers are fictional. Extract the whole archive to a folder. Run: python3 replay.py Only standard Python 3 is needed. No network or model call is made. The script creates actual-result.json and compares it with expected-result.json. First pass: 12 events, 11 unique, 2 records, 4 source messages. Second pass: 0 new events, no changes to records or decisions. Assertions are in run(). Real delivery, permissions and model output need separate tests. What the agent should receive Request and facts: “We need a landing page for an installation service.” Preserve a source-message reference. Budget stays unknown unless the customer provides it. [____] [____] [____] Open questions: Are materials ready? Who approves the result? What follow-up has actually been agreed? These remain questions until answered. [____] [____] [____] Reason and handoff state: The customer requested a person, no permitted answer was found, or an individual estimate is needed. “Waiting for an agent” and “accepted by an agent” are separate states. [____] [____] [____] Owner and next step: A record has one current owner. The next step follows an agreed rule; delivering a notification does not mean the agent accepted responsibility. [____] [____] [____] History and access: Share only the relevant context. Agree retention, roles, attachments and what may be sent to an external model before launch. [____] [____] [____] One current mode for each conversation Bot handles the conversation: Only agreed replies are permitted. A new message changes the current context version. [____] [____] [____] Waiting for an agent: Autonomous replies have already stopped. The queue, waiting time and person responsible for delayed requests are visible. The handoff request is recorded. [____] [____] [____] Accepted by an agent: The agent handles replies. A late bot draft must not be sent even if the model began preparing it earlier. [____] [____] [____] Closed: The outcome and closing reason are recorded. A new independent question follows an agreed rule for opening a new request. [____] [____] [____] What happens when something fails CRM unavailable: Keep the message in a protected queue. Show the pending handoff and retry with the same operation key. Do not say an agent accepted until that is true. [____] [____] [____] Repeated Telegram update: Check the source key. A delivery identifier and a business-request identifier solve different problems. A new message in an existing conversation is not a duplicate of its earlier message. [____] [____] [____] Late model output: Recheck the context version and mode before applying it. Hold or discard output prepared from an earlier context. [____] [____] [____] No available agent: Use the agreed waiting and escalation path. Show an honest status without inventing a response deadline. [____] [____] [____] Edited messages: Edits and attachments need their own source-update rules. A customer’s text cannot assign an agent, expose another customer’s data or authorize an outgoing action. [____] [____] [____] What to check before enabling autonomous replies Customer asks for a person: The bot stops immediately, the request enters a queue, and an agent separately acknowledges acceptance. [____] [____] [____] Context changes: A draft based on an older message is not automatically sent. Unknown budget and deadlines stay unknown. [____] [____] [____] Retry and outage: One event does not create two records. When the CRM returns, the record contains the permitted history. [____] [____] [____] Two agents and two conversations: Ownership is unambiguous. Another conversation’s data appears in neither the record nor a reply. [____] [____] [____] Access revoked or conversation closed: An unauthorized colleague cannot read history or attachments. The bot does not restart on its own after closure. [____] [____] [____] First phase, cost and ongoing ownership First-phase scope: A handoff map, minimum context packet, connection to one CRM, failure rules, an evaluation set and acceptance checks. [____] [____] [____] Cost drivers: An existing messaging connector, CRM fields, roles, context volume, system count, attachments, model requirements and access rules. These inputs are needed before a meaningful estimate. [____] [____] [____] After launch: Agree who monitors the queue, investigates delays, updates instructions, checks model costs and handles API changes. Support terms are separate. [____] [____] [____] Measuring value: Track time to agent acceptance, incomplete handoffs, duplicate records and summary-review time. Conversations are not qualified enquiries or sales. [____] [____] [____]