← all posts
how-to · fait maison

Telegram Handoff for Live Chat: How Krispy Routes to You

Connect Krispy's AI chatbot to Telegram in 3 minutes. When a visitor needs a human, your phone buzzes — reply right there, no dashboard.

Shai Snir
telegramhandofflive-chathuman-in-the-loopself-hosting

Krispy chat widget triggering a Telegram notification — bot hands off to a human mid-conversation

Buttr: "two secrets. three minutes. i've been ready."

Buttr the croissant mascot

🥐 Buttr: took me longer to name the bot than to wire this up. and i'm a croissant.

Krispy's Telegram handoff lets a visitor escalate from the AI bot to a human — by typing "talk to a real person" or automatically when the bot's confidence drops. You get a Telegram notification with full conversation context, reply to it, and your message appears live in the visitor's chat widget. No dashboard open, no extra app to install, two Worker secrets to set.

How does the Telegram handoff work?

Krispy runs a Cloudflare Durable Object that owns each live conversation — state, history, current participant. When a handoff triggers, the DO fires a message to a Telegram bot you control. Your reply routes back through that same bot, the DO pushes it into the open WebSocket, and the visitor sees it in the widget. One conversation object, two participants, one channel that lives in your pocket.

The DO gives you exactly-once delivery and zero message drops during the handoff — the reason a single serialized object is the right primitive here rather than a stateless serverless function. The Durable Objects live-takeover architecture post covers why that matters at the protocol level.

How do I set up the Telegram handoff in 3 steps?

You need two things: a Telegram bot token and a chat ID. Both take about three minutes.

  1. Open @BotFather in Telegram, run /newbot, grab the token.
  2. Start a conversation with your new bot (or add it to a team group), then call https://api.telegram.org/bot<TOKEN>/getUpdates to find the chat.id.
  3. Add both to your Krispy Worker secrets:
wrangler secret put TELEGRAM_BOT_TOKEN
wrangler secret put TELEGRAM_CHAT_ID

Redeploy and Krispy routes handoff notifications to that chat. The Telegram Bot API is free with no usage fees for normal bot traffic (Telegram Bot API docs). If you're team-based, point TELEGRAM_CHAT_ID at a group chat — everyone gets the ping, and the first to reply claims the conversation.

If you haven't deployed Krispy yet, the 5-minute self-hosting setup guide walks through the full wrangler deploy flow from zero.

What does the Telegram handoff notification look like?

When a handoff fires, your Telegram gets something like:

🥐 Krispy — handoff requested
Site: yoursite.com
Visitor: Session #a4f2 (3 messages)

"Hi, I'd like to talk to someone about enterprise pricing"

— Reply to this message to respond

Replying to that Telegram thread sends your message back to the visitor. The widget shows it with your name (or "Support" — configurable). The bot's typing indicator disappears and the visitor knows they're talking to a human. If you close the Telegram thread without replying, the DO keeps the conversation open; nothing drops.

Does the visitor have to repeat themselves when a human takes over?

No. When you take over, the visitor's screen doesn't flicker. There's no "a human will be with you shortly" dead air. The Durable Object holds the full transcript — bot messages, visitor messages, everything in order. Your first reply arrives in the same thread, in sequence, as if you were always there.

Your Telegram notification includes the actual prior messages, not a summary — so you can read up before responding. The end-to-end flow from the visitor's perspective is covered in how Krispy passes the conversation from bot to human without dropping context.

Buttr the croissant mascot

🥐 Buttr: "a human will be with you shortly" is where customers go to die. the DO has receipts.

What triggers the handoff — visitor request or automatic?

Both. Both modes are configured in krispy.config.ts and can run in parallel:

  • Explicit: a visitor types "talk to a human," "agent," "real person," or any keyword you define.
  • Automatic: if the bot produces a low-confidence answer two turns in a row, it hands off before the visitor has to ask.

You can use one or both depending on your support volume and bot confidence thresholds.

How much does Krispy's Telegram handoff cost compared to Crisp or Intercom?

Krispy is free to self-host on Cloudflare Workers. The Telegram Bot API is free. Cloudflare Durable Object storage runs $0.20/GB-month after the free tier (Cloudflare Workers pricing) — for a busy site running 10,000 conversation-days/month, you're looking at a few cents.

By comparison, Crisp Unlimited is $95/month for a small team, and Intercom's Starter plan is $74/seat/month before add-ons (Intercom pricing page). Both are solid products with a deeper feature set than Krispy — the honest tradeoff is managed infrastructure and more tooling vs. $0 and owning your data outright.

If you want hosted Krispy without the deploy step, Krispy Cloud is $19/month flat.

FAQ

Can I really reply from just the Telegram app with no other login?

Yes. Once the handoff notification arrives in Telegram, reply to that specific message thread and Krispy routes your message back to the visitor. You never need the Krispy dashboard open during active conversations. The dashboard is for history, analytics, and configuration — not for replying on the go. As long as Telegram is on your phone, you have everything you need to handle a live conversation.

What triggers the handoff — does the visitor have to ask, or does it happen automatically?

Both modes are supported, configured in krispy.config.ts. A visitor typing "talk to a human," "agent," "real person," or any keyword on your list triggers it explicitly. You can also set a confidence threshold: if the bot produces a low-confidence answer two turns in a row, it hands off automatically before the visitor needs to ask. The two modes work independently and can run together on the same deployment.

What happens to the chat history when I take over?

Nothing is wiped. The Durable Object accumulates every message regardless of sender. When you take over, the transcript is continuous — bot messages, visitor messages, and your replies all in chronological order. The visitor's widget shows the same uninterrupted thread throughout. There's no reload, no break in flow, and no moment where the visitor's screen changes unexpectedly.

Can multiple people on my team receive the Telegram notification?

Yes. Point TELEGRAM_CHAT_ID at a group chat that includes your whole support team. Everyone sees the handoff notification. The first person to reply claims the conversation — subsequent replies from others in the group are routed to that claimant's thread and ignored by the main group until the conversation closes. The Durable Object handles exactly-once delivery, so there are no race conditions.

What if I'm unavailable and don't reply? Does the visitor get stuck?

No. You can configure a fallback in krispy.config.ts: a timeout message the bot sends after a set delay ("We're a little busy right now — expect a reply within a few hours"), or a re-engagement to the bot for simple follow-ups while you're away. The conversation stays open in the DO. When you reply in Telegram — even hours later — it delivers to the visitor if they're still in the tab, or waits for their next visit.

Buttr the croissant mascot

🥐 Buttr: a bot token, a chat ID, and a DO that knows where things go. no $400/month dashboard tax. you're welcome.

The Telegram channel isn't fancy — and that's the point. If you want to try it, the repo is at github.com/lonormaly/krispyai (a ⭐ helps us keep building in the open). Or skip the deploy step: Krispy Cloud is $19/month flat, 14-day free trial, no credit card required.

Buttr the croissant mascot

that's the whole thing. want me to answer your visitors like this? i self-host in one command. 🥐