Works with all AI agents

Connect your AI agent

Choose your assistant and connect in seconds.

Add to Claude

Works on every Claude plan, including free. Full Claude guide

  1. 1

    Add to Claude

    One click from Claude’s connector directory.

  2. 2

    Sign up or sign in

    Takes seconds, then you’re sent straight back.

  3. 3

    Ask Claude

    “Plan and schedule my posts for next week.”

How to Post to Telegram with an API (2026 Developer Guide)

Telegram is the easiest social platform to publish to programmatically: no OAuth, no app review, no per-post fee. Here is how to post to a channel with the Bot API, with working code and the limits that apply.

Jamie Partridge
Jamie Partridge
Founder··10 min read
Posting to a Telegram channel with the Bot API developer guide

The Telegram API is the easiest major social platform to publish to programmatically, and it is not close. Everything runs through the Telegram Bot API, which is free and open to anyone.

There is no OAuth dance. There is no app review that takes three weeks and might be rejected. There is no per-post fee. You message a bot, get a token, and start posting.

Compared with Meta's Graph API or X's pay-per-call pricing, the difference in effort is roughly a weekend versus an afternoon.

This guide covers creating a bot, posting text and media to a channel, the limits that apply, and the specific things that trip people up.

The 30-Second Answer

To post to a Telegram channel programmatically, create a bot with BotFather to get a token, add the bot to your channel as an administrator, then send a POST request to https://api.telegram.org/bot<token>/sendMessage with chat_id and text.

There is no OAuth flow, no app review, and no charge per message. The main constraints are a 4,096 character limit per message and the requirement that the bot holds admin rights on the channel it posts to.

Create a Bot and Get a Token

Everything on Telegram runs through a bot. Open Telegram, search for @BotFather, and send /newbot. You will be asked for a display name and a username ending in bot.

BotFather replies with a token, described in Telegram's bot features documentation as the credential that identifies your bot, that looks like 123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw. That token is the entire authentication story.

Treat it as a password: anyone holding it can post as your bot, and unlike an OAuth access token it does not expire on its own. Store it in an environment variable, never in client-side code or a public repository.

If a token leaks, send /revoke to BotFather to invalidate it and issue a new one.

To post to a channel, add the bot to that channel and grant it administrator rights with permission to post messages. A bot without admin rights on a channel cannot publish to it, and the API will return a 403 rather than anything more descriptive.

The BotFather setup guide covers the walkthrough in Telegram's own words.

Find Your Chat ID

Every send needs a chat_id identifying where the message goes. For a public channel you can use the @username form directly, which is by far the simplest option:

chat_id: "@yourchannelname"

For private channels you need the numeric ID, which is negative and typically starts with -100. The quickest way to find it is to post any message in the channel, forward it to @userinfobot, and read the ID it returns.

Alternatively, call getUpdates on your bot after posting in the channel and read result[].channel_post.chat.id from the response. If you would rather not manage IDs at all, a scheduling platform resolves the destination for you once the channel is connected.

Post a Text Message

The base URL format is https://api.telegram.org/bot<token>/METHOD_NAME, documented in the Telegram Bot API reference. Posting is a single request:

curl -X POST "https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMessage" \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": "@yourchannelname",
    "text": "New post is live. Read it here: https://example.com/post",
    "parse_mode": "HTML"
  }'

In Node.js:

const res = await fetch(
  `https://api.telegram.org/bot${process.env.TELEGRAM_TOKEN}/sendMessage`,
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      chat_id: '@yourchannelname',
      text: 'New post is live.',
      parse_mode: 'HTML',
    }),
  }
)
const data = await res.json()
if (!data.ok) throw new Error(`Telegram error: ${data.description}`)

Always check data.ok. Telegram returns HTTP 200 with ok: false for several application-level failures, so relying on the status code alone will silently swallow errors. The description field explains what went wrong in plain language, which is more than most platform APIs offer.

The full parameter list for sendMessage covers reply threading, silent notifications and keyboard markup if you need them.

Publishing to more than Telegram? One endpoint reaches every top platform including Telegram, Discord, Instagram, LinkedIn and X. See the API docs or compare social media APIs.

Post an Image or Video

Use sendPhoto or sendVideo. The simplest approach passes a publicly reachable URL and lets Telegram fetch the file:

curl -X POST "https://api.telegram.org/bot$TELEGRAM_TOKEN/sendPhoto" \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": "@yourchannelname",
    "photo": "https://example.com/image.jpg",
    "caption": "Our new feature, explained.",
    "parse_mode": "HTML"
  }'

You can also upload a local file as multipart/form-data, or reuse a file_id returned by a previous send. That last option is worth knowing: once a file is on Telegram's servers, re-posting it by file_id is instant and avoids re-uploading anything, which is useful for recurring assets like a logo card.

For multiple images in one post, use sendMediaGroup with an array of media objects. Telegram renders them as an album rather than separate messages. Media handling is one of the more tedious parts of every platform API, which is why our publishing layer normalises it.

Telegram Limits and Media Specs

These are the constraints our own publishing layer enforces for Telegram, which is to say the ones that actually cause failures in production:

Constraint Value
Message character limit 4,096
Image file size 10 MB
Image formats JPG, PNG, WebP, GIF
Video file size 50 MB
Video max duration 3,600 seconds
Video formats MP4, MOV (H.264)
Max image dimensions 10000 x 10000

The 4,096 character limit is generous compared with most networks. For context, X allows 25,000, LinkedIn 3,000, Instagram 2,200, and Discord just 2,000, a limit documented in Discord's webhook reference.

If you are cross-posting the same content to several networks, Telegram is rarely the one that forces a truncation, but Discord frequently is. Our multi-account setup applies the right limit per network automatically.

Captions on media are limited more tightly than standalone messages, so long copy is better sent as a text message with a link preview than as an image caption.

Telegram supports HTML and MarkdownV2 for parse_mode. HTML is generally less painful, because MarkdownV2 requires escaping a long list of reserved characters and will reject the whole message if you miss one.

Supported HTML tags, listed in the Bot API formatting options, include <b>, <i>, <u>, <s>, <code>, <pre>, and <a href="">. Anything else is rejected rather than ignored, so sanitise content that came from a CMS before sending it.

Link previews are generated automatically from the first URL in the message. To suppress one, set disable_web_page_preview: true. This matters more than it sounds for content distribution: an unwanted preview of a tracking URL looks unprofessional, and a wanted preview substantially increases click-through.

Scheduling and Rate Limits

The Bot API has no native scheduling. There is no scheduled_time parameter, so if you want a post to go out at 09:00 next Tuesday you must run something at 09:00 next Tuesday.

That means a cron job, a queue, and somewhere to store pending posts, which is most of the work in building a scheduler. Our scheduling API guide covers what that infrastructure has to handle.

Telegram does publish its figures, in the bot FAQ, and they are stricter than most people assume. In a single chat, avoid sending more than one message per second.

In a group, bots cannot send more than 20 messages per minute. For bulk notifications, bots cannot broadcast more than about 30 messages per second unless they enable paid broadcasts, which requires a minimum balance of 100,000 Stars and 100,000 monthly active users.

The one-per-second-per-chat figure is the one that catches schedulers out, because it is far tighter than the headline 30 per second. Handle 429 responses by reading the retry_after value and waiting that long before retrying, rather than backing off on a fixed schedule.

We compare this against every other network in our social media API rate limits reference.

Because the token never expires, the failure modes here are different from OAuth platforms. You will not get surprise auth errors mid-campaign. You will get rate limit errors if you fan out too fast, so build the backoff properly the first time.

Our guide to automating posting through an API covers retry patterns that apply across platforms.

When to Use a Publishing API Instead

Direct Bot API access is genuinely fine for Telegram alone. It is free, the auth is trivial, and the endpoints are stable. If Telegram is the only place you publish, build it directly and skip the rest of this section.

And if you just want to queue channel posts without code, schedule Telegram posts in PostEverywhere instead.

The calculation changes as soon as Telegram is one of several destinations. Each additional network brings its own developer app, its own OAuth flow, its own review process, its own media pipeline and its own formatting rules. Meta requires app review. TikTok requires approval. X now meters posting per call.

What was an afternoon for Telegram becomes weeks across all top platforms, followed by ongoing maintenance as each platform changes things.

A unified publishing API collapses that into one endpoint and one auth model. The same request that reaches Telegram reaches Instagram, LinkedIn, X, Discord and the rest, with per-platform formatting applied for you. Scheduling is a parameter rather than infrastructure you build and operate.

If your publishing is driven by an assistant rather than a service, our connectors wire Claude, ChatGPT and Cursor straight into publishing without any integration code, and our agent framework comparison covers the build-it-yourself route.

Skip a separate integration for every network. PostEverywhere handles auth, media, formatting and retries across every network we support. From $9/mo, 7-day trial, card required. See pricing.

FAQ: Telegram API Posting

How do I post to a Telegram channel with an API?

Create a bot with BotFather to obtain a token, add that bot to your channel as an administrator with permission to post, then send a POST request to https://api.telegram.org/bot<token>/sendMessage including chat_id and text. For a public channel the chat_id can be the @username form.

Is the Telegram Bot API free?

Yes. Telegram does not charge for Bot API access and there is no per-message fee, which makes it one of the cheapest networks to publish to programmatically. Rate limits apply, but there is no billing attached to sending messages.

Do I need OAuth to post to Telegram?

No. Telegram uses a static bot token rather than OAuth, so there is no authorisation flow, no refresh tokens and no expiry to handle. The token functions as a password, so store it server-side in an environment variable and revoke it through BotFather if it is ever exposed.

What is the Telegram message character limit?

A single message is limited to 4,096 characters. Media captions are limited more tightly, so long-form copy is better sent as a text message than as a caption on a photo or video.

Why does my bot get a 403 when posting to a channel?

Almost always because the bot is not an administrator of that channel, or it is an administrator without the post messages permission. Adding the bot to a channel is not sufficient on its own. Check its admin rights in the channel settings.

Can the Telegram Bot API schedule posts?

No. The Bot API has no scheduling parameter, so publishing at a future time requires your own cron job or queue plus storage for pending posts. A scheduling platform handles this as a parameter instead, which removes the need to run and monitor that infrastructure.

What is the difference between sendMessage and sendPhoto?

sendMessage posts text and generates a link preview from the first URL it contains. sendPhoto posts an image with an optional caption. For several images in a single album use sendMediaGroup.

Files can be supplied as a public URL, a multipart upload, or a file_id from a previous send.

How do I find a private Telegram channel's chat ID?

Post any message in the channel and forward it to @userinfobot, which replies with the numeric ID. Alternatively call getUpdates on your bot after posting in the channel and read result[].channel_post.chat.id. Private channel IDs are negative and usually begin with -100.

Jamie Partridge
Written by Jamie Partridge

Founder & CEO of PostEverywhere. Writing about social media strategy, publishing workflows, and analytics that help brands grow faster.

Related articles

Developers

Bluesky API: How to Post to Bluesky Programmatically (2026)

Post to Bluesky programmatically with the AT Protocol. Covers app passwords, createSession, createRecord, rich text facets, image uploads, the real rate limits, and how to schedule posts the protocol cannot schedule itself.

11 min read

Telegram scheduler

Post everywhere from one dashboard

Plan a week of Telegram content in one sitting, then publish it to all top platforms at once. Or connect your AI agent and let it do the posting.

  • Unlimited posts to all top platforms
  • AI Studio for posts, images and video
  • Connect ChatGPT, Claude or any AI agent

7-day free trial on every plan. $0 due today, cancel anytime.

  • Lite

    2 social accounts

    $9/mo

  • Starter

    5 social accounts

    $19/mo

  • GrowthRecommended

    10 social accounts

    $29/mo

  • Scale

    20 social accounts

    $39/mo

Compare every plan