Published on and updated on
How to Deploy a Telegram Userbot
Deploy your own userbot with Heroku or locally.
A Telegram userbot is basically something that can help you manage stuffs here and there in Telegram such as groups etc. How it works is that you type the command, for example
.time, then you send it anywhere in Telegram, the userbot will detect the command and edit your message to show you the output of current time in your local timezone in that message. Take some note that some commands do require specific conditions to be met in order to work properly. An userbot is not like usual Telegram bots which have their dedicated username on it but it acts as a session of your own account. An userbot is safe to use providing you don't use something that Telegram is probably having some sense of dislike to such as
.spam. Heroku gives you 550 hours of free monthly usage as well as 450 more if you add your credit card as your billing info. Don't worry as it's completely free and you would not have to pay any cents at all.
Update: This post now includes how to deploy it locally. So cheers!
API Hash and API ID.
- Login to my.telegram.org with your Telegram account.
- Go to API Development Tools, fill out the form for creating an app. You'll get the required API Hash and API ID there.
Note: Nothing really matters, fill in anything that you want.
Generate a session string.
- Go to here and click on run button on top.
- Enter the API Hash and API ID you've got from the previous step.
- Enter your phone number with country code (example: +62896xxxxxxxx).
- Follow further instructions then check your Saved Messages in Telegram, there will be your session string.
Note: Don't share your session string to anyone, anywhere, anytime. Imagine a key to your house, then imagine if it's in someone's hand.
Get BOTLOG_CHATID (Optional but recommended).
- Create a group with you and add @MissRose_bot to your group.
/idand send it to the group. Rose will give you the group chat ID.
Note: Don't leave out the - in there. It is essential.
Get Heroku API key (if you use Heroku).
The next step is to deploy it. There are 2 ways of deploying it:
- Head to WeebProject's Github repo here or use this link to directly deploy it to Heroku.
- Fill your app name and choose which region is closest to your location.
- Fill in the form with everything you got from previous section. Also read through the options of configuration and add/change them according to your own needs.
Note: You can change the values anytime you want later on.
- Leave the logging options as they are (It's enabled by default).
- Click on Deploy App option at the bottom of the page.
- Click on the View button once it's successfully deployed.
- Navigate to the Resources tab, click the pencil icon, and turn the worker on if it's not enabled yet.
- Click on More button on the top right, and then click on View logs.
- If it prints
Congratulations, the bot is up and running! Send .help in any chat for more info.or something similar, then everything's good.
You can send
.helpin any chat for more info. If you want info on specific module, send
.helpfollowed by the name of module listed in the
.helpsection you've opened before.
Note: You'll need to run Linux to do this and have installed
docker-composeand also enabled the
docker.service(if you don't know how to enable it then here's a quick command:
sudo systemctl enable --now docker). Windows user better get their WSL ready.
- Clone the repository using git and use it as our working directory.
git clone https://github.com/BianSepang/WeebProject .userbot
sample_config.envand paste it as
cp sample_config.env config.env
config.envusing your favorite text editor and add the required values. Set
postgresql://USERNAME:PASSWORD@db:5432/weebprojectwhere USERNAME is your preferred username and PASSWORD is your preferred password.
After you done, edit
docker-compose.ymlusing your favorite editor and change USERNAME and PASSWORD matching what you set before.
Run it using
sudo docker-compose up
Systemd Service (Optional)
You can do a systemd service to autostart the userbot everytime you boot.
Save it at
/etc/systemd/system/userbot.service and change the
WorkingDirectory value accordingly. Enable and start it using:
sudo systemctl enable --now userbot
.update in any chat. If there's any, send
.update deploy to update the userbot.
There you go! That's all you need to deploy a userbot. As always, thank you for following this guide.
- https://github.com/BianSepang/WeebProject - Weebproject - BianSepang
- https://kenharris.xyz/userbot.html - Setting up a Telegram userbot - KenHV
- https://nru.my.id/post/cara-pasang-userbot-telegram-dengen-docker/ - Cara Pasang Userbot Telegram dengan Docker - んる
Post Copyright Notice
Assets Copyright Notice
All other assets used in this post may or may not be licensed under the same license as this post. Please check the original source for more information.
If you are the owner of the asset and want it to be removed, please contact me.