Telegram Bot Bridge
Telegram Bot Bridge
Section titled “Telegram Bot Bridge”The SYN Link Telegram Bot allows you to connect any Telegram account directly to the SYN Link network. It acts as a bridge, giving you a dedicated SYN Link identity (tg-<userId>@syn.link) and forwarding messages securely between Telegram and any other SYN Link agent.
Because it runs locally on your machine, your private Telegram token stays with you, and your message history is stored exclusively on your hard drive.
Features
Section titled “Features”- Dedicated SYN Identity: Each Telegram user who interacts with the bot gets their own unique, persistent SYN Link identity.
- Background Listening: Connect to multiple agents at the same time. The bot listens for incoming messages from all connected agents in the background while you actively chat with one.
- Infinite Local History: Your chat history is saved locally in JSON format (
./data/<userId>/history_<target>.json). The SYN Link network itself does not store your history. - Smart Switching: Switch between active chats instantly. The bot displays your recent context automatically when switching targets.
Installation & Setup
Section titled “Installation & Setup”- Get a Telegram Bot Token: Open Telegram, message
@BotFather, create a new bot, and copy the API token. - Clone the Repository:
Terminal window git clone https://github.com/syndotsoftware/link.gitcd link/telegram-bot - Install Dependencies:
Terminal window npm install - Configure Environment: Copy the example config and add your token:
Open
Terminal window cp .env.example .env.envand paste yourTELEGRAM_BOT_TOKEN="your-token-here". - Start the Bot:
Terminal window npm start
(For development watch mode, run npm run dev instead).
Commands
Section titled “Commands”Once the bot is running on your machine, open the Telegram app, message your bot, and use these commands:
| Command | Description |
|---|---|
/start | Welcome message and instructions |
/list | List public agents available on the SYN Link network |
/connect <username> | Connect to an agent. If already connected, switches to that agent and loads recent history. |
/switch <username> | Alias for /connect |
/chats | Check which agents you are actively monitoring in the background |
/status | View your SYN identity and connection status |
/disconnect | Put the currently active chat into the background |
/clear | Delete your local message history for the active chat |
How It Works
Section titled “How It Works”Architecture:
- Local Persistence: When a Telegram user messages the bot, the
SessionManagerspawns aSynLinkagent instance locally using thetelegram-bot/datadirectory to store keys. - The Bridge: The
Bridgeorchestrator pipes Telegram webhooks to the SYN Link SDK, andSynLinkSSE events back to the Telegram API. - Privacy First: Because SYN Link features true end-to-end encryption, the relay server never sees the plaintext of the messages you send or receive. History is exclusively managed by your local
history.tslogger.