← Back to developers

Docs

Everything you need to launch a white-label Telegram bot powered by AI Snapsolve.

Quickstart

The full flow takes about a minute. Skip ahead if you already have a Telegram bot token.

1

Create your Telegram bot via @BotFather

Open @BotFather in Telegram. Send /newbot, choose a display name, then a username ending in _bot. BotFather replies with your token — it looks like:

123456789:AAH-...your-token-here...
2

Add the bot in your dashboard

Go to /developers/bots, click New bot, paste the token, give it a name, and (optionally) write a system prompt to define its persona.

3

Done

We register the webhook with Telegram and start handling messages. Open Telegram, search for your bot's username, send a message — your bot replies via the AI Snapsolve agent using your token. Usage shows up in the dashboard within seconds.

How it works

Once your bot is registered, every inbound message follows this path:

User → Telegram → AI Snapsolve webhook → AI agent → Telegram → User

1. End user messages your bot on Telegram (@YourBot_bot).
2. Telegram POSTs the update to:
   POST /api/telegram/whitelabel/<your-bot-id>
   Header: x-telegram-bot-api-secret-token: <per-bot-secret>
3. We verify the secret, look up your bot row in dev_bots,
   atomically check + bump the monthly quota.
4. We assemble the AI request:
   - system: your custom system_prompt (or default)
   - history: last 10 messages for this (bot, chat_id) pair
   - user: the inbound message text
5. Claude or GPT generates a reply.
6. We send the reply via:
   POST https://api.telegram.org/bot<your-token>/sendMessage
7. Both messages are persisted to dev_bot_messages for analytics.

Writing a good system prompt

The system prompt is your bot's personality and rules. Keep it focused.

Good example

You are an AP Calculus study coach.
- Solve problems step-by-step, showing the key intermediate steps.
- Use **bold** for the final answer.
- If a question is outside calculus, gently redirect: "I focus on calculus — try @AiSnapsolve_bot for general help."
- Keep replies under 250 words unless the problem genuinely needs more.

Tips

  • Set a tone (warm, blunt, sarcastic — your call).
  • Give an explicit scope — what topics, what to refuse.
  • Mention formatting: Markdown **bold** and `code` render in Telegram.
  • Avoid contradictions — if you say “always be brief” and also “always show full work”, the AI will pick one.

Quotas and rate limits

Each bot has its own monthly request budget. One inbound message processed = one request. Replies, retries, and command-only responses (/start, /help) don't count.

PlanMonthly limitBots
Free1,0001
Starter25,0003
Pro250,00010
EnterpriseCustomUnlimited

When a bot hits its quota, end users see a friendly “quota reached” message. Counters reset at the start of each calendar month (UTC).

Security

  • Per-bot webhook secrets. When you create a bot, we generate a unique secret and tell Telegram to include it on every update via the x-telegram-bot-api-secret-token header. Requests without the right secret are rejected.
  • Row-level security. Your bots and message logs are RLS-protected: only your Supabase user can read them. Backend writes go through the service role.
  • Token rotation. If your token is leaked, regenerate it via /revoke in BotFather, then delete + recreate the bot here with the new token.

FAQ

Do my users need an AI Snapsolve account?

No. They just message your bot on Telegram like any other bot.

Can I use group chats?

Yes. Add your bot to a group, set its privacy to “disabled” in BotFather (so it sees all messages), and it'll respond to messages addressed to it.

Can I run more than one bot?

Yes — Free is 1 bot, Starter is up to 3, Pro is up to 10, Enterprise unlimited. Each bot has independent settings, system prompt, and quota.

What models do you use?

Claude (Sonnet) by default with GPT-4o fallback. Pro and Enterprise tiers can opt into reasoning-agent mode (multi-step tool use).

Where are messages stored?

In dev_bot_messages on our Supabase instance, scoped to your bot via RLS. Retention is currently unlimited; we'll add a setting before any change.