Skip to content

chatman-media/telegram-badge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Telegram Badge Generator

πŸ‡·πŸ‡Ί Русский | πŸ‡©πŸ‡ͺ Deutsch | πŸ‡«πŸ‡· FranΓ§ais | πŸ‡ͺπŸ‡Έ EspaΓ±ol | πŸ‡΅πŸ‡Ή PortuguΓͺs | πŸ‡ΈπŸ‡¦ Ψ§Ω„ΨΉΨ±Ψ¨ΩŠΨ© | πŸ‡―πŸ‡΅ ζ—₯本θͺž | πŸ‡°πŸ‡· ν•œκ΅­μ–΄ | πŸ‡ΉπŸ‡­ ΰΉ„ΰΈ—ΰΈ’ | πŸ‡¨πŸ‡³ δΈ­ζ–‡

Build Status Release npm version JSR npm bundle size TypeScript License: MIT

GitHub stars dev.to X (Twitter)

This project generates SVG badges with the current member count of your Telegram groups and channels. Perfect for displaying community activity in GitHub README files or on websites.

Supports both:

  • πŸ‘₯ Telegram Groups - Interactive communities where all members can send messages
  • πŸ“’ Telegram Channels - Broadcast channels where only admins can post messages

Both groups and channels use the same API endpoint and work identically with this badge generator.

Quick Start

Just use URL parameters to generate badges for any Telegram group or channel:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel_or_group

Telegram Members


Tech Stack

  • Node.js / TypeScript
  • Telegram Bot API
  • Vercel (Serverless API)
  • Jest for testing
  • Biome for linting and formatting

Usage

Primary Method: URL Parameters (No Setup Required!)

Simply add your Telegram group or channel ID to the URL:

![Telegram Badge](https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel_or_group)

Works with:

  • Public channels: @your_channel
  • Public groups: @your_group
  • Private groups/channels: -1001234567890 (numeric chat ID)

That's it! No deployment, no bot token needed for public groups and channels.

Alternative Method: Self-Hosted Deployment

For advanced users who want to host their own instance:

1. Prerequisites

  • Telegram Bot Token (create via @BotFather)
  • Vercel account (or any Node.js hosting)

2. Deploy to Vercel

Deploy with Vercel

Set environment variables:

  • BOT_TOKEN: Your Telegram bot token
  • CHAT_ID: Default chat ID (optional if using URL parameters)

3. Local Development

git clone https://github.com/chatman-media/telegram-badge.git
cd telegram-badge
npm install

# Create .env file
echo "BOT_TOKEN=your_bot_token" > .env
echo "CHAT_ID=@your_channel" >> .env

npm run dev

Styling Parameters

You can customize the badge appearance using the following parameters:

Parameter Description Default Value
channelId Telegram chat ID or username (e.g., @your_channel) From environment
style Badge style flat
label Label text Telegram
color Main badge color 2AABEE (Telegram color)
labelColor Label color 555555
logo Show Telegram logo true

Available styles:

  • flat - flat style (default)
  • plastic - plastic style with gradient
  • flat-square - flat square style without rounded corners
  • for-the-badge - wide style with uppercase letters
  • social - GitHub social style

Examples:

Standard badge (flat style):

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel

Flat

Badge with plastic style:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=plastic

Plastic

Badge with flat-square style:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=flat-square

Flat-Square

Badge with for-the-badge style:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge

For-The-Badge

Badge with social style:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=social

Social

Badge with custom label and color:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&label=Join%20Chat&color=00FF00

Custom

Fully customized badge:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge&label=Community&color=FF5733&labelColor=1A1A1A

Full Custom

Badge without logo:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&logo=false

No Logo

Badge for specific channel:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel

Badge with custom styling:

https://telegram-badge.vercel.app/api/telegram-badge?channelId=@your_channel&style=for-the-badge&color=FF5733

Features

  • πŸ‘₯ Real-time member count display
  • πŸ”— Direct URL parameters - no setup required!
  • 🎨 Full badge appearance customization
  • πŸ”’ Optional self-hosting with secure token storage
  • ⚑ Optimized caching for fast loading
  • πŸ›‘οΈ Error handling with informative messages
  • πŸ†“ Free to use
  • πŸ“‘ Can be extended to show activity/message count
  • πŸ§ͺ Comprehensive test suite with TypeScript

API Usage

As npm package:

npm install telegram-badge
import badgeHandler from "telegram-badge";

// Use in your serverless function
export default badgeHandler;

As Deno/JSR package:

# Using JSR
deno add @chatman-media/telegram-badge

# Or import directly
import badgeHandler from "jsr:@chatman-media/telegram-badge";
import badgeHandler from "@chatman-media/telegram-badge";

// Use in your Deno serverless function
export default badgeHandler;

Direct API calls:

GET /api/telegram-badge?channelId=@your_channel&style=flat&label=Members&color=2AABEE&labelColor=555555

Testing

Run the test suite:

npm test

Run type checking:

npm run type-check

Build the project:

npm run build

FAQ

What's the difference between Telegram Groups and Channels?

Telegram Groups:

  • πŸ‘₯ Interactive communities where all members can send messages
  • Members can see each other and interact
  • Can have up to 200,000 members
  • Example: @your_group

Telegram Channels:

  • πŸ“’ Broadcast channels where only admins can post messages
  • Subscribers cannot see each other
  • Can have unlimited subscribers
  • Example: @your_channel

For this badge generator: Both groups and channels work exactly the same way! The Telegram Bot API treats them identically for getting member/subscriber counts.

How do I find my Group/Channel ID?

For public groups/channels:

  • Use the username: @your_channel or @your_group

For private groups/channels:

  • Use a bot like @userinfobot
  • Forward any message from your group/channel to the bot
  • It will show the chat ID (like -1001234567890)

Do I need a bot token?

No bot token needed for public groups and channels when using the hosted service at telegram-badge.vercel.app.

Bot token required only for:

  • Private groups/channels
  • Self-hosted deployments

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Subscribe

Stack Overflow profile

chatman
Repos Followers Thailand Rank

GitHub Followers TikTok twitch YouTube Telegram X

Support πŸ’πŸš€

  • BTC: 14s9Y9Rb2CUWHSAatiQMhfkpx1MWXofUzw
  • TON: UQBx7Sgtn5q_PzwUAjvnA_lj9CQx1NhN9JDi3abOgpRYnAnr
  • NOT: UQBx7Sgtn5q_PzwUAjvnA_lj9CQx1NhN9JDi3abOgpRYnAnr
  • ETH: 0x286D65151b622dCC16624cEd8463FDa45585fd60
BTC TON NOT ETH

Star History

Star History Chart

Repo Activity

Alt

License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❀️ by Chatman Media

About

Telegram Group/Channel Badge Generator - generates SVG badges with the current member count of your Telegram group.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •