rony-chat-bot/data/projects/bot-onboarding.md

35 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

---
title: "Telegram Onboarding Bot"
date: 2024-04
status: "archived"
tags: ["Node.js", "PostgreSQL", "Telegram", "bot", "onboarding"]
repo: "https://github.com/example/bot-onboarding"
demo: ""
---
# Telegram Onboarding Bot
Conversational bot that walks new users through the initial setup of a B2B product.
## Description
A Telegram assistant that reduces the time-to-first-value of a B2B product. Replaces an 8-step web form with a guided conversation. Each user has a long-running state machine that persists across days.
## Tech stack
- **Runtime:** Node.js
- **Database:** PostgreSQL (state persistence per user)
- **Bot API:** Telegram Bot API with inline keyboards
- **State machine:** Hand-rolled, no FSM library
## Main features
1. Conversational onboarding replacing the legacy 8-step form
2. Long-running per-user state machine with PostgreSQL-backed persistence
3. Telegram inline keyboards keep interaction inside the chat app
4. Watchdog that re-sends the last message if the user has not responded in 24h
## Learnings
Handling Telegram timeouts without losing user state was the main challenge. The watchdog pattern with an explicit "give up" option turned out to be more reliable than trying to be too clever about timeout semantics. The state machine approach beat a more declarative framework for this use case because every state had bespoke transitions.