🤖 ChatID Helper Bot

Effortlessly help you get your chat ID — simple and convenient. All the code is open-sourced on GitHub

ChatIDHelperBot

ChatID Helper Bot

Effortlessly retrieve chat IDs with ease and convenience! This Telegram bot, built on Cloudflare Workers, requires no server deployment.

Example Bot: ChatIDHelperBot


https://github.com/CECEthanClarke/get-chatid-bot-cf-worker

Deployment Guide

Step 1: Create Your Telegram Bot

  1. Go to @BotFather on Telegram and use the /newbot command to create your bot.
  2. Follow the prompts to provide the required information.
  3. Once created, @BotFather will send you the bot’s token. This token is essential for deployment—save it for later use.

Step 2: Learn to Deploy Cloudflare Workers

  1. Refer to the Cloudflare Workers Deployment Guide.
  2. Download the bot’s source code.
  3. Run npm run deploy locally to deploy your worker.

Step 3: Configure Required Environment Variables

To run the bot successfully, two environment variables must be set:

  • BOT_TOKEN
  • BOT_SECRET_TOKEN

Refer to the Cloudflare Workers documentation for adding environment variables.

Details:

  1. BOT_TOKEN: Copy and paste the token received from @BotFather into this variable.
  2. BOT_SECRET_TOKEN: This is a value you define yourself. It must meet the following criteria:
    • 1-256 characters in length.
    • Allowed characters: A-Z, a-z, 0-9, _, and -.
    • This ensures the bot’s security.

Step 4: Set the Webhook URL

Access the following API endpoint in your browser to configure the webhook URL:

https://api.telegram.org/bot<token>/setWebhook?url=<url>&secret_token=<BOT_SECRET_TOKEN>

Replace the placeholders <token>, <url>, and <BOT_SECRET_TOKEN> with your actual values:

  • <token>: Your bot’s token from @BotFather.
  • <url>: The URL provided by Cloudflare after deploying your worker.
  • <BOT_SECRET_TOKEN>: The value you defined in Step 3, ensuring it matches exactly.