@mosaicstack/telegram-plugin (0.0.2)
Installation
@mosaicstack:registry=npm install @mosaicstack/telegram-plugin@0.0.2"@mosaicstack/telegram-plugin": "0.0.2"About this package
@mosaicstack/telegram-plugin
@mosaicstack/telegram-plugin connects a Telegram bot to the Mosaic gateway chat namespace so Telegram chats can participate in the same conversation flow as the web, TUI, and Discord channels.
Required Environment Variables
TELEGRAM_BOT_TOKEN: Bot token issued by BotFatherTELEGRAM_GATEWAY_URL: Base URL for the Mosaic gateway, for examplehttp://localhost:3000
What It Does
- Launches a Telegram bot with
telegraf - Connects to
${TELEGRAM_GATEWAY_URL}/chatwithsocket.io-client - Maps Telegram
chat.idvalues to MosaicconversationIdvalues - Forwards inbound Telegram text messages to the gateway as user messages
- Buffers
agent:start/agent:text/agent:endsocket events and sends the completed response back to the Telegram chat
Getting a Bot Token
- Open Telegram and start a chat with
@BotFather - Run
/newbot - Follow the prompts to name the bot and choose a username
- Copy the generated token and assign it to
TELEGRAM_BOT_TOKEN
Dependencies
Dependencies
| ID | Version |
|---|---|
| socket.io-client | ^4.8.0 |
| telegraf | ^4.16.3 |
Development Dependencies
| ID | Version |
|---|---|
| typescript | ^5.8.0 |
| vitest | ^2.0.0 |