Skip to main content
Deploy and manage AI agents directly from Telegram without needing a terminal or website. This guide will walk you through the commands and architecture necessary to utilize this feature.

Commands

Here are the available commands you can use to interact with your AI agents via Telegram:

Architecture

The architecture for deploying and managing AI agents from Telegram is as follows:

User Identity

There are two primary flows for user identity management:
  1. Telegram-only: Automatically provision a profile, organization, and free plan using ensureUser() and create_telegram_user() RPC.
  2. Web→Telegram: Generate a link token from the dashboard, use t.me/bot?start=link_TOKEN, and the bot will link to your existing account.

Billing Gate

Before deploying with /launch, the system checks if deployment is allowed by comparing the plan’s agents_deployed limit with usage_metrics. After a successful deployment, trackAgentDeploy() increments the usage count.

Module Structure

The following is the structure of the Telegram bot module:

Environment Variables

Configure the following environment variables in your .env file:

LucidMerged Migrations

The following migrations are applied to manage Telegram user links and plan limits:
  • 079_telegram_user_links.sql — Creates the telegram_user_links table and sets agent deployment plan limits.
  • 080_telegram_user_provisioning.sql — Implements the create_telegram_user() RPC.
  • 081_telegram_account_link_tokens.sql — Manages link tokens and their creation/consumption through RPCs.