This guide will help you deploy a fully functional Telegram bot that removes the background from images using the Remove.bg API and runs on Cloudflare Workers.
Step 1: Create a Telegram Bot
To create a Telegram bot, follow these steps:
- Open BotFather on Telegram.
- Send
/newbot
and follow the instructions. - Choose a unique bot name and username.
- Bot Name: Can be anything (e.g., `bgremoveBot`)
- Copy the API Token provided by BotFather.
Example API Token:
API1234567890:ABCDEFGHIJKLMNOpQRSTUVWXYZ
-
Step 2: Get BG Remover API Key
To get an API key from Bg-Remover:
- Go to BG Remover API and sign up.
- Log in and navigate to the API Key section.
- Generate an API key and copy it.
Example API Key:
BG-REMOVER APIuSPCzTnE7nEpSb9zqvUzekHw
-
Step 3: Deploy on Cloudflare Workers
Now, we will deploy our bot on Cloudflare Workers.
- Sign up or log in to Cloudflare.
- Go to Workers &awp; Pages in your Cloudflare dashboard.
- Click "Create Application" and select "Worker".
- Enter a name for your Worker and click "Deploy".
- After deployment, click on the Worker name to open its settings.
- Click "Edit Code" section.
- Delete the default code in the editor.
- Paste your code into the editor.
- Click "Save and Deploy" to update your Worker.
- Copy the assigned URL and use it as needed.
-
Step 4: Set Webhook
To connect the bot with Cloudflare:
- Now Open Webhook Setter Tool
- Replace Bot Token & Cloudflate-Workers Url.
- Enter Your Bot Token → Your Bot API Token
- Enter Your Server URL → Your Cloudflare Worker URL

Done! Test Your Bot
Now, open Telegram, send any image, and see the background magically removed!

Watch this video for better guidance on setting up and using the bot.

Need Help?
If you face any issues, feel free to ask on Comment Section!