Telegram Bot

Setting up the Telegram bot

Follow the 5 steps below to launch the bot. It takes about 5 minutes.

📋 What you need

  • A Telegram account
  • Access to @BotFather (Telegram’s built-in bot)
  • An OG Studio deployment (for example, on Vercel)
1

Create a bot in @BotFather

  1. 1. Open Telegram → find @BotFather
  2. 2. Send the command /newbot
  3. 3. Choose a name (for example, “OG Studio Bot”)
  4. 4. Choose a username (for example, @og_studio_bot)
  5. 5. BotFather returns a token like 123456:ABC-DEF1234...
2

Generate a secret token

A random string (1–100 characters, A-Z, a-z, 0-9). It is checked in every webhook request.

TELEGRAM_WEBHOOK_SECRET=asecretstring_1234567890abcdef
3

Set the environment variables

On Vercel: Settings → Environment Variables. Locally: in the .env file.

# Telegram Bot
TELEGRAM_BOT_TOKEN=123456:ABC-DEF1234...
TELEGRAM_WEBHOOK_SECRET=your-secret-string

# App URL (where OG Studio is deployed)
NEXT_PUBLIC_APP_URL=https://og-studio.vercel.app
4

Register the webhook

Run in a terminal (replace {TOKEN} and {SECRET} with yours):

curl https://api.telegram.org/bot{TOKEN}/setWebhook \
  -d url=https://og-studio.vercel.app/api/telegram/webhook \
  -d secret_token={SECRET}

You should get JSON with "ok":true.

5

Test the bot

  1. 1. Find your bot in Telegram by its username
  2. 2. Press “Start” or send /start
  3. 3. The bot should send a welcome message with an “Open the editor” button
  4. 4. Try /gen coffee of the future
  5. 5. Send a link to any article or website — the bot reads it

📖 Bot commands

/startWelcome + buttons
/gen <topic>Generate an OG image for a topic
/link <email>Link your account to sync Pro (or the “Link” button in your profile on the site — one click, no code)
/meAccount status
/helpAll commands
/languageBot language: English or Russian (by default, as in your Telegram settings)
📎 URLSend a link to an article or website → the bot reads it and makes an OG image