File To Link Telegram Bot Using Cloudflare Workers.
const BOT_TOKEN = "BOT_TOKEN"; // Insert your bot token.
const BOT_WEBHOOK = "/endpoint"; // Let it be as it is.
const BOT_SECRET = "BOT_SECRET"; // Insert a powerful secret text.
const BOT_OWNER = 123456789; // Insert your telegram account id.
const BOT_CHANNEL = -100123456789; // Insert telegram channel id.- Get
BOT_TOKENfrom @botfather. - Change
BOT_WEBHOOKwith your preferred webhook. - Change
BOT_SECRETwith a powerful secret text. - Get
BOT_OWNERfrom @idbot. - Get
BOT_CHANNELid by forwarding a message from channel to @idbot.- Channel ID must start with
-100. - Bot must be admin in channel with edit rights.
- Channel ID must start with
- Create a Cloudflare account.
- Navigate to
Workers & Pages > Create > Create Worker. - Deploy the worker by clicking Deploy.
- Edit the code by clicking Edit Code.
- Upload
worker.jsinto Cloudflare. - Modify the variables.
- Finally, Deploy.
- Once you deployed the bot on Cloudflare.
- Open
XXX.XXXX.workers.dev/registerWebhookto register your bot. - Then you can start using your bot.
- Response Example:
Telegram Link: t.me/botusername/?start=ZG9uJ3QgZGVjb2RlDownload Link: XX.XX.workers.dev/?file=ZG9uJ3QgZGVjb2Rl