From 09d5f82d8efe2d6850a5596164930642b2792fea Mon Sep 17 00:00:00 2001 From: TheAchiever6823 <61914223+ShawnMadadha@users.noreply.github.com> Date: Mon, 18 May 2026 11:05:06 -0700 Subject: [PATCH] =?UTF-8?q?[shawn]=20feat:=20BotFather=20setup=20wizard=20?= =?UTF-8?q?=E2=80=94=204-step=20guided=20flow=20for=20non-dev=20Telegram?= =?UTF-8?q?=20users?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/app/pages/Tools/Tools.tsx | 145 ++++++++++++++++++++++++- 1 file changed, 140 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/pages/Tools/Tools.tsx b/frontend/src/app/pages/Tools/Tools.tsx index f76a72c5..7afee5a1 100644 --- a/frontend/src/app/pages/Tools/Tools.tsx +++ b/frontend/src/app/pages/Tools/Tools.tsx @@ -348,7 +348,8 @@ const INTEGRATIONS: Integration[] = [ color: '#229ED9', website: 'https://core.telegram.org/bots', connectLabel: 'Connect Telegram Bot', - connectInstructions: 'Open Telegram → message @BotFather → send `/newbot` → pick a name and username for your bot (e.g. ShawnsOpenSwarmBot). @BotFather will reply with a token like `123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11`. Paste that token below. After connecting, DM your bot anything and OpenSwarm runs it as an agent task. First message auto-authorizes you as owner.', + // No connectInstructions here — the credentials dialog renders a 4-step + // guided wizard for this tile (see telegramBotStep handling). credentialFields: [ { key: 'TELEGRAM_BOT_TOKEN', label: 'Bot Token (from @BotFather)', placeholder: '123456:ABC-DEF1234ghIkl-...', type: 'password' }, ], @@ -771,6 +772,9 @@ const Tools: React.FC = () => { } | null>(null); const [telegramInput, setTelegramInput] = useState(''); + /** Telegram Bot setup wizard step (1=open BotFather, 2=send /newbot, 3=name+username, 4=paste token). */ + const [telegramBotStep, setTelegramBotStep] = useState(1); + // Full-auth upgrade dialog (password + 2FA) is disabled while we figure out // Instagram's trusted-notification polling endpoint. Connect uses browser-only // sign-in, which unlocks ~8 read tools. See handleInstagramConnect below. @@ -1468,6 +1472,8 @@ const Tools: React.FC = () => { setCredDialogIntegration(integration); setCredDialogValues(initial); setCredDialogOpen(true); + // Reset multi-step wizards + if (integration.id === 'telegram-bot') setTelegramBotStep(1); }; const handleCredentialsSave = async () => { @@ -3197,6 +3203,116 @@ const Tools: React.FC = () => { Click Sign in with Slack below — a Slack window will open. Sign in normally and the window will close automatically once you reach your workspace. + ) : credDialogIntegration?.id === 'telegram-bot' ? ( + + {/* Step progress dots */} + + {[1, 2, 3, 4].map((n) => ( + + ))} + + + Step {telegramBotStep} of 4 + + + {telegramBotStep === 1 && ( + <> + + Open BotFather in Telegram + + + BotFather is the official Telegram account that creates bots. Tap below to open it in your Telegram app. + + + + Once BotFather opens, tap Start at the bottom of the chat. Then come back here and click Next. + + + )} + + {telegramBotStep === 2 && ( + <> + + Tell BotFather to create a new bot + + + In your BotFather chat, send this exact message: + + + + /newbot + + + + + BotFather will reply asking for a name. Click Next when you're ready to continue. + + + )} + + {telegramBotStep === 3 && ( + <> + + Name your bot + + + BotFather will ask two questions, in order: + + + + 1. Name — anything you want. Example: My OpenSwarm + + + 2. Username — must end in bot. Example: my_openswarm_bot + + + + If the username is taken, BotFather will tell you — just try another. Once you're done, BotFather replies with a long token starting with numbers. Copy it, then click Next. + + + )} + + {telegramBotStep === 4 && ( + <> + + Paste your bot's token + + + The token looks like 123456789:ABC-DEF1234ghIkl-... + + setCredDialogValues((prev) => ({ ...prev, TELEGRAM_BOT_TOKEN: e.target.value }))} + fullWidth + size="small" + sx={{ '& .MuiOutlinedInput-root': { bgcolor: c.bg.page, fontFamily: c.font.mono, fontSize: '0.85rem' } }} + /> + + After connecting, restart OpenSwarm and DM your new bot from any Telegram device to start using it. + + + )} + ) : credDialogIntegration?.id === 'telegram' && telegramFlow ? ( <> @@ -3249,8 +3365,17 @@ const Tools: React.FC = () => { )} + {/* Back button for telegram-bot wizard, steps 2-4 */} + {credDialogIntegration?.id === 'telegram-bot' && telegramBotStep > 1 && ( + + )}