Skip to main content
RapidDev - Software Development Agency
lovable-integrationsNative Shared Connector

How to Integrate Lovable with Telegram

Connect Telegram to your Lovable app in under 10 minutes using the native Telegram connector. Go to Settings → Connectors, activate Telegram, paste your Bot API token, then describe the bot behavior you want in Lovable's chat. The AI generates the Edge Function handler, command routing, and UI automatically — no manual code wiring required.

What you'll learn

  • How to create a Telegram bot and get a Bot API token from BotFather
  • How to activate the Telegram connector in Lovable's Settings → Connectors panel
  • How to store your Bot API token securely in Cloud → Secrets
  • How to prompt Lovable's AI to generate bot command handlers and notification logic
  • How to test your bot end-to-end from a live Telegram conversation
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner14 min read10 minutesCommunicationMarch 2026RapidDev Engineering Team
TL;DR

Connect Telegram to your Lovable app in under 10 minutes using the native Telegram connector. Go to Settings → Connectors, activate Telegram, paste your Bot API token, then describe the bot behavior you want in Lovable's chat. The AI generates the Edge Function handler, command routing, and UI automatically — no manual code wiring required.

Build Telegram Bots Directly Inside Lovable

Telegram's Bot API is one of the most powerful free messaging APIs available — bots can receive commands, send rich messages, handle inline queries, and deliver notifications to individual users or groups. With Lovable's native Telegram connector, you get all of that without writing a single line of bot infrastructure code from scratch. The AI understands the Bot API's capabilities the moment you activate the connector, so describing what your bot should do is enough to generate working, production-ready handlers.

The integration works through Lovable's Edge Function layer. When a user sends your bot a message, Telegram delivers it as a webhook POST request to a Supabase Edge Function that Lovable generates for you. That function parses the update, routes commands, executes your logic (database writes, external API calls, conditional replies), and sends a response back through the Bot API — all server-side, with your API token stored safely in Cloud Secrets and never exposed to the browser.

This makes Telegram a strong choice for founders building internal tools, community notifications, customer support bots, or any product where users already live in Telegram. Unlike SMS (which costs per message via Twilio) or Slack (which requires users to have a workspace), Telegram bots are free to message and reach over 950 million monthly active users globally.

Integration method

Native Shared Connector

Telegram is one of Lovable's 17 shared connectors — activated in Settings → Connectors, it gives the AI full context of the Bot API so it can auto-generate message handlers, command routing, and Edge Functions from a single chat prompt.

Prerequisites

  • A Lovable account with a project open (any plan — Telegram connector is available on all plans)
  • A Telegram account on your phone or desktop to create the bot via BotFather
  • Basic idea of what you want your bot to do (e.g., send notifications, handle commands, answer questions)

Step-by-step guide

1

Create Your Telegram Bot with BotFather

Every Telegram bot starts with BotFather — Telegram's official bot for creating and managing other bots. Open Telegram (app or web at web.telegram.org) and search for '@BotFather' in the search bar, then tap the verified BotFather account (it has a blue checkmark). Send the message '/newbot' to start the creation flow. BotFather will ask you for two things: a display name for your bot (this is what users see in their chat list, e.g., 'My App Notifications') and a username that must end in 'bot' (e.g., 'myapp_notifybot'). Usernames must be unique across all of Telegram — if your first choice is taken, try adding your app name or a number. Once you confirm both, BotFather replies with a success message containing your bot's API token — a long string that looks like '7312456789:AAHxxx...'. Copy this token immediately and store it somewhere safe. You will paste it into Lovable's Cloud Secrets in the next step. Also note the t.me/yourbotusername link BotFather provides — this is how users will start a conversation with your bot. Do not share your API token publicly; anyone with this token can control your bot.

Expected result: You have a live (but empty) Telegram bot, a Bot API token string, and the bot's t.me link. The bot appears in your Telegram contacts but does not respond to any messages yet.

2

Activate the Telegram Connector in Settings → Connectors

In your Lovable project, click the gear icon in the top-right corner to open Settings, then navigate to the Connectors section in the left sidebar. You will see two tabs: 'Shared connectors' and 'Personal connectors (MCP)'. Stay on the Shared connectors tab. Scroll down the list of 17 connectors until you find Telegram — it sits in the Communication category alongside Twilio. Click on the Telegram connector card to expand it. You will see a toggle to activate the connector and a field to enter your Bot API token. Flip the toggle to the active position. A prompt appears to enter your credentials — do NOT paste your token into this visible form field if you are on the free plan, as free-tier chat history is publicly visible. Instead, click 'Manage in Cloud Secrets' (or navigate directly to Cloud → Secrets via the + button next to your project preview). In the Secrets panel, click 'New secret', name it TELEGRAM_BOT_TOKEN (all caps, underscores), and paste your Bot API token as the value. Click Save. Return to Settings → Connectors → Telegram and confirm the connector shows as active. Lovable will now have full awareness of the Telegram Bot API when you describe features in chat, and your token will be securely injected into Edge Functions at runtime via Deno.env.get('TELEGRAM_BOT_TOKEN').

Expected result: The Telegram connector card shows a green 'Active' status in Settings → Connectors. TELEGRAM_BOT_TOKEN appears in your Cloud → Secrets panel with a masked value.

3

Prompt Lovable to Generate Your Bot's Message Handler

With the connector active, open Lovable's chat and describe what you want your bot to do. The AI now understands the Telegram Bot API in full — you just need to express your requirements in plain English. Be specific about the commands you want, the data those commands should read or write (e.g., from your Supabase database), and the format of replies. Lovable will generate a Supabase Edge Function as the webhook receiver, register the webhook URL with Telegram's Bot API automatically, and wire the handler to your app's logic. The generated Edge Function will live at supabase/functions/telegram-webhook/index.ts in your project. If you want a notification system instead of a command bot, describe the trigger (e.g., 'when a new order is placed, send the order details to this Telegram chat ID'). For command bots, list each command and what it returns. The AI handles routing, parsing the update object, extracting chat IDs and message text, and formatting the sendMessage API call — you do not need to know the Bot API specification to get working code.

Lovable Prompt

I have the Telegram connector active. Build a Telegram bot that handles these commands: /start (welcome message with instructions), /status (query the 'orders' table in Supabase and return the count of open orders for the user), /help (list available commands). Use the TELEGRAM_BOT_TOKEN secret. Set up a webhook Edge Function at /telegram-webhook that receives Telegram updates, routes commands, and replies in the same chat. Make the replies formatted with line breaks for readability.

Paste this in Lovable chat

Expected result: Lovable generates a telegram-webhook Edge Function, deploys it to Cloud, and registers it as the webhook URL with Telegram's Bot API. You can see the function in Cloud → Logs. Sending /start to your bot in Telegram returns a welcome message within a few seconds.

4

Send Proactive Notifications from Your App to Telegram

Beyond responding to user commands, one of the most powerful use cases is sending proactive notifications from your app to a Telegram chat. This requires knowing the chat ID of the recipient — Telegram assigns a unique numeric chat ID to every conversation. The easiest way to capture a user's chat ID is to have them send your bot any message (even just /start), then log the chat ID from the incoming webhook update to your Supabase database. From that point, your app can send them messages at any time by calling Telegram's sendMessage API with their stored chat ID. In Lovable's chat, describe the notification trigger and the message format you want. The AI will generate an Edge Function (or add logic to an existing one) that calls the Telegram Bot API's sendMessage endpoint with your bot token and the target chat ID. This pattern works for order confirmations, alert systems, SaaS usage warnings, team notifications, or any event-driven message your app needs to push. Lovable automatically routes this call through an Edge Function so your bot token never touches the browser, and Deno.env.get('TELEGRAM_BOT_TOKEN') is used server-side throughout.

Lovable Prompt

Add a Telegram notification system to my app. When a new row is inserted into the 'signups' Supabase table, send a Telegram message to chat ID stored in the 'admin_settings' table (field: telegram_chat_id) with the new signup's name and email. Format the message clearly with line breaks. Use the TELEGRAM_BOT_TOKEN secret and call the Telegram sendMessage API from a new Edge Function called 'notify-telegram'. Trigger this Edge Function from the signup creation flow.

Paste this in Lovable chat

Expected result: A new Edge Function 'notify-telegram' is deployed. When a signup is created in your app, a formatted Telegram message arrives in the configured chat within seconds. Cloud → Logs shows successful 200 responses from the Telegram API.

5

Test End-to-End and Verify in Cloud Logs

Testing your Telegram integration requires using the live bot, not Lovable's preview mode. Lovable's preview runs in an iframe that cannot receive Telegram webhooks. Open the t.me/yourbotusername link BotFather gave you, or search for your bot username in Telegram, and start a conversation. Send each command you configured (/start, /status, /help, or whatever you specified) and verify the replies match your expectations. For notification tests, trigger the relevant action in your live app (e.g., submit a signup form) and check that the Telegram message arrives. If a command does not respond, go to Cloud → Logs in your Lovable project (click the + icon next to your preview, then choose Logs). Filter by your telegram-webhook function. You will see each incoming update logged with its status code. A 200 OK means the function ran successfully. A 500 error means the function threw an exception — click the log entry to see the full error message. Common first-time issues are a missing or misnamed secret (check TELEGRAM_BOT_TOKEN spelling in Cloud → Secrets matches exactly what the Edge Function uses) or the webhook not being registered (prompt Lovable: 'Re-register the Telegram webhook URL for my bot'). Once commands and notifications are working in your live app, your integration is production-ready.

Lovable Prompt

Check whether the Telegram webhook is correctly registered for my bot. If not, re-register it using the deployed Edge Function URL and my TELEGRAM_BOT_TOKEN secret. Show me the current webhook info from Telegram's getWebhookInfo API.

Paste this in Lovable chat

Expected result: All bot commands return correct replies in your Telegram client. Cloud → Logs shows 200 OK for each incoming webhook update. Telegram's getWebhookInfo confirms the webhook URL points to your live Edge Function.

Common use cases

Prompt Lovable to Generate Your Bot's Message Handler

Use Telegram with Lovable to prompt lovable to generate your bot's message handler. This is one of the most common use cases when integrating Telegram into your Lovable application.

Lovable Prompt

I have the Telegram connector active. Build a Telegram bot that handles these commands: /start (welcome message with instructions), /status (query the 'orders' table in Supabase and return the count of open orders for the user), /help (list available commands). Use the TELEGRAM_BOT_TOKEN secret. Set up a webhook Edge Function at /telegram-webhook that receives Telegram updates, routes commands, and replies in the same chat. Make the replies formatted with line breaks for readability.

Copy this prompt to try it in Lovable

Send Proactive Notifications from Your App to Telegram

Take your Telegram integration further by send proactive notifications from your app to telegram. This builds on the basic setup to create a more complete experience.

Lovable Prompt

Add a Telegram notification system to my app. When a new row is inserted into the 'signups' Supabase table, send a Telegram message to chat ID stored in the 'admin_settings' table (field: telegram_chat_id) with the new signup's name and email. Format the message clearly with line breaks. Use the TELEGRAM_BOT_TOKEN secret and call the Telegram sendMessage API from a new Edge Function called 'notify-telegram'. Trigger this Edge Function from the signup creation flow.

Copy this prompt to try it in Lovable

Test End-to-End and Verify in Cloud Logs

Prepare your Telegram integration for production by test end-to-end and verify in cloud logs. Ensures your integration works reliably for real users.

Lovable Prompt

Check whether the Telegram webhook is correctly registered for my bot. If not, re-register it using the deployed Edge Function URL and my TELEGRAM_BOT_TOKEN secret. Show me the current webhook info from Telegram's getWebhookInfo API.

Copy this prompt to try it in Lovable

Troubleshooting

Bot does not respond to any messages

Cause: The webhook URL is not registered with Telegram, or the Edge Function is not deployed to the live environment.

Solution: Open Cloud → Logs and check whether any requests from Telegram are arriving at all. If there are no log entries, the webhook is not registered. Prompt Lovable: 'Re-register the Telegram webhook using getWebhookInfo and setWebhook with my deployed Edge Function URL.' Also verify the app is deployed (not just in preview) — webhooks only reach deployed Edge Functions, not preview URLs.

Edge Function returns 500 — Secret TELEGRAM_BOT_TOKEN not found

Cause: The secret name in Cloud → Secrets does not exactly match the name used in the Edge Function code. Telegram Bot tokens are long strings and the name must match character-for-character, including case.

Solution: Go to Cloud → Secrets (click + next to your preview → Secrets). Confirm the secret is named exactly TELEGRAM_BOT_TOKEN with no extra spaces, lowercase letters, or hyphens. If the name differs, delete the existing entry and re-create it with the exact correct name. Then redeploy the Edge Function by prompting Lovable: 'Redeploy the telegram-webhook Edge Function.'

Bot responds in preview but not in the deployed app

Cause: Lovable's preview iframe cannot receive Telegram webhook POST requests from Telegram's servers. The webhook URL must point to the deployed Edge Function URL, not the preview URL.

Solution: Always test Telegram bots using the deployed app URL, not the preview pane. Click Publish in Lovable to deploy the latest changes, then test from your Telegram client. If the webhook was accidentally registered to the preview URL, prompt Lovable: 'Update the Telegram webhook registration to use the production Edge Function URL.'

Best practices

  • Store your Bot API token exclusively in Cloud → Secrets as TELEGRAM_BOT_TOKEN — never paste it into Lovable's chat, code fields, or anywhere client-side. On the free plan, chat history is publicly visible.
  • Set bot commands in BotFather using /setcommands so users see an autocomplete menu when they type / in the chat. List each command and a one-line description matching what your Lovable bot handles.
  • Always store the user's Telegram chat ID in your Supabase database when they first message the bot — this is the only way to send proactive notifications later. Add a 'telegram_chat_id' column to your users table.
  • Use Telegram's sendMessage with parse_mode set to 'Markdown' or 'HTML' for formatted messages. Bold headings, code blocks, and line breaks make bot replies much easier to read than plain text.
  • Keep command handlers idempotent — if Telegram retries a webhook delivery (which it does on timeout), your Edge Function should not double-process the same update. Check the update_id before writing to the database.
  • Test every command with unexpected inputs. Users will send text where a number is expected, or fire commands in the wrong order. Prompt Lovable to add input validation and friendly error messages for each command.
  • Use Telegram groups sparingly for bot deployments — group bots receive all messages and need to check whether the message is directed at the bot (via @mention or command). Direct message bots are simpler to start with.
  • For complex bot workflows or multi-step conversation flows, consider prompting Lovable to store conversation state in a Supabase table keyed by chat ID, so the bot can remember context across multiple messages.

Alternatives

Frequently asked questions

Is the Telegram connector free to use in Lovable?

Yes. The Telegram Bot API itself is free with no per-message costs, and Lovable's native Telegram connector is available on all plans including the free tier. The only usage cost comes from Lovable Cloud Edge Function invocations, which are included in your monthly Cloud balance. For most bots handling a few hundred messages per day, costs are negligible.

Can my Telegram bot work in group chats, not just direct messages?

Yes. Add your bot to any Telegram group and it will receive group messages as webhook updates. Group bots typically respond only to commands prefixed with / or messages that @mention the bot username. When prompting Lovable to set up group bot handling, specify whether you want the bot to respond to all messages or only direct commands so the AI generates the correct routing logic.

How do I send a Telegram message to a user who has never messaged my bot first?

You cannot. Telegram's Bot API requires a user to initiate contact with your bot before you can send them messages — this is a deliberate anti-spam restriction. The standard approach is to send users your bot's t.me link (e.g., 't.me/yourbotusername?start=ref123') and ask them to tap Start. Once they do, your webhook receives their chat ID and you can store it for future notifications.

What is the difference between using Telegram and Twilio for notifications in Lovable?

Telegram is free per message but requires users to have the Telegram app and start a conversation with your bot first. Twilio sends SMS to any phone number on any carrier with no app required, but charges per message (typically $0.0075–$0.01 per SMS in the US). For user communities already on Telegram, the bot approach is far more cost-effective. For reaching any phone number without requiring an app, Twilio is the better choice.

Can I have multiple Telegram bots for different projects in the same Lovable workspace?

Yes, but the Telegram connector is a shared connector configured at the workspace level with one Bot API token. If you need separate bots for separate projects, create separate Lovable workspaces (or separate projects) and configure a different TELEGRAM_BOT_TOKEN secret in each. You can create as many bots as you need via BotFather — each bot gets its own unique token.

My bot stopped responding after I redeployed my app — how do I fix it?

Redeployments can occasionally cause the Telegram webhook URL to become stale if the Edge Function URL changes. Open Cloud → Logs to check whether Telegram updates are arriving. If there are no log entries, the webhook is not reaching your function. Prompt Lovable: 'Check my Telegram webhook registration with getWebhookInfo and re-register it with the current deployed Edge Function URL if it has changed.' For complex debugging, RapidDev's team can audit webhook registrations and Edge Function configurations directly.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.