Skip to main content

Managed Channels

Deploy and manage AI agents directly from Telegram without the need for a terminal or website.

Commands

Here are the available commands you can use to interact with the Lucid platform via Telegram:

Architecture

The architecture for managing Telegram interactions is as follows:

User Identity

There are two primary flows for user identity management:
  1. Telegram-only: The ensureUser() function automatically provisions a profile, organization, and free plan using the create_telegram_user() RPC.
  2. Web→Telegram: The dashboard generates a link token which can be used with t.me/bot?start=link_TOKEN. The bot consumes this token to link to an existing account.

Billing Gate

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

Module Structure

The following is the structure of the Telegram bot module:

Environment Variables

The following environment variables are required for the Telegram bot API:

LucidMerged Migrations

The following migrations are applied to the LucidMerged database:
  • 079_telegram_user_links.sql — Adds the telegram_user_links table and agents_deployed plan limits.
  • 080_telegram_user_provisioning.sql — Implements the create_telegram_user() RPC.
  • 081_telegram_account_link_tokens.sql — Adds link tokens and create/consume RPCs.