-
-
Notifications
You must be signed in to change notification settings - Fork 154
Getting started
To use the Telegram Bot API,
you first have to get a bot account
by chatting with BotFather.
Write @botfather the /newbot
command to create a bot.
Then follow the process and copy the token you get at the end of the process.
BotFather will give you a token, something like 123456789:AbCdfGhIJKlmNoQQRsTUVwxyZ
.
Create a new group by opening the sidebar in Telegram then clicking on New Group
.
After the group is created add the bot you created in the last step to it. Once added, click on the group name and you should see the group members. Long tap or right-click on the bot and make it an admin.
To get the group ID you can add @bostrot_bot to your group and type /id
. It should return two IDs. The first one is your USER ID, the second the GROUP ID. Remember both of them.
NOTE: If you get the group ID BEFORE adding another admin to your staff group keep in mind that you need to get the ID again with /id as it changes when a second admin is added. (Only one time)
Get the latest stable version of the bot from the releases page, e.g. with:
wget https://github.com/bostrot/telegram-support-bot/archive/refs/tags/v4.1.1.zip
unzip v4.1.1.zip
cd telegram-support-bot-4.1.1
For v2 or lower: Rename the config-sample.ts
file in the config
folder to config.ts
.
For v3 and above: Rename the config-sample.yaml
file in the config
folder to config.yaml
.
Now fill in the TOKEN, USER ID, GROUP ID:
bot_token: "TOKEN"
staffchat_id: "GROUP_ID"
owner_id: "USER_ID"
This should be the basic configuration. You can adjust the other settings depending on your needs.
If you want to deploy this with Docker you can directly go to the Docker section.
Install NodeJS 14.x using Debian, as root (for Ubuntu and others check out this):
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt-get install -y nodejs
Install build-essential
apt-get install -y build-essential
Install npm dependencies
npm i -g pm2
To run the bot in the background use pm2
pm2 start "npm run dev" --name bostrot
You can also run the bot with docker:
docker-compose:
docker-compose up -d
or without docker-compose:
docker build -t bostrot/telegram-support-bot:latest .
docker run bostrot/telegram-support-bot:latest -v /path/to/config_dir:/bot/config
Prebuild docker containers are also available for stable versions and the master branch. It is recommend to use the latest release instead of master.
e.g.
docker run bostrot/telegram-support-bot:v4.0.1 -v /path/to/config_dir:/bot/config