Guidelines

How to get credentials, create an App, copy the secret, then build Telegram for your product — with the management panel, Open API, or an AI using the files below.

Walkthrough video

Preview of how to connect. Open in Google Drive

1. Login

Ask the operator for the Telegram admin URL, username, password, and your tenant id. Log in to the Telegram management panel. This sample UI is not the admin login.

2. Create a new App

Panel → Apps → Add. Choose Managed (templates + routes in the panel) or Passthrough (your backend returns every chat message). Enable the App and note the numeric App id. One App = one reply style; use two Apps if you need both.

3. Get the secret key

App → Backend: set your service public URL, inbound path /telegram/inbound for Passthrough, save and reveal the secret key. The same secret signs inbound HMAC and Open API MD5. Paste URL, app id, and secret on this sample’s Connection page (MySQL table telegram_connection), not in YAML.

4. Build the related service

After the App exists you can:

  • Telegram management panel — add bots, templates, event routes, groups, channels by form or JSON import (one object at a time).
  • Open API — this sample’s Open API tabs, or your own POST /telegram/v1/... client with MD5 sign.
  • Your inbound APIs — Passthrough /telegram/inbound and/or Managed REMOTE paths. Telegram users never hit this sample’s webhook. Photos: image can be an http(s) link or base64 (data:image/png;base64,...). This sample sends base64.

Passthrough photos

JSON field image (also photo / photoUrl). You can use either:

  • Link"image": "https://cdn.example.com/card.png"
  • Base64"image": "data:image/png;base64,..." (this sample always uses this)

Use mode: MESSAGE when sending a new photo (edit does not replace the picture).

Use these when you (or an AI) implement another service. Import JSON in the panel or push via Open API.

FileWhat it is
getting-started.md Login → create App → secret → panel vs API Download
hmac-inbound.md HMAC headers and Passthrough / Managed response JSON Download
open-api.md MD5 sign and every /telegram/v1 path Download
ai-prompt-telegram-app.md Prompt to paste into an AI with the other files attached Download
managed-templates.json Recharge templates (import one object, or Open API create) Download
managed-routes.json Recharge REMOTE event routes Download

Using these files with AI

First pick one way to connect, or several. Tell the AI which ones.

PickSimple meaning
Managed The Telegram panel stores message templates and routes. Your app only returns numbers/text (vars) when a route is REMOTE. Best if operators edit messages in the panel.
Passthrough Every chat tap is sent to your app. You return the full message (text + buttons). Optional photo on image: an http(s) link or base64 data URL.
Open API Your app calls the Telegram service to add bots, groups, channels, templates, routes, and send broadcasts. Best for automation; often used together with Managed or Passthrough.

Examples: “Managed only”, “Passthrough only”, “Open API + Passthrough”, or “all three” (needs two Apps: one Managed, one Passthrough).

  1. Download the zip (or each file).
  2. Open ai-prompt-telegram-app.md and copy the prompt.
  3. In Cursor (or another AI), paste the prompt, write which mechanism(s) you picked, and attach getting-started, hmac-inbound, open-api, and both JSON files.
  4. Fill Telegram base URL, tenant id, and App ids. Do not commit the secret.
  5. Ask the AI to generate only those parts. Then in the panel: create the App, paste backend URL and secret. For Managed, import JSON or Open API → Template / Event → Push demo.