Telegram Anti Phishing Admin Bot Setup Guide Installation and Deployment Instructions Telegram BOT Monitor allows automatic monitoring of Telegram group members and banning members impersonating group administrators. Please follow instructions bellow to deploy BOT Monitor to Telegram group. Start Guide To create a BOT that will be assigned to group for active monitoring, use Telegram’s BotFather as described Login to your Telegram account, if you do not have one you can register one for free on https://telegram.me Next Step Creating Group Bot 1 Previous Step After logging to your Telegram account, call BotFather on following link: https://telegram.me/botfather Next Step 2 Previous Step Click the button „Open in Web“ Next Step 3 Previous Step To get a list of available commands available type command /start in the chat window. Next Step 4 Previous Step To create a new bot type the command /newbot in the chat to create new BOT Next Step 5 Previous Step Once BotFather asks for the bot name, enter the prefered name of your new BOT, e.g. MyGroupBOT. Next Step 6 Previous Step Each bot name must be unique, if you type in a invalid name for your bot you will recieve a warning to change it to a new one. Enter the username for your new BOT (it must end with the word bot), e.g. MyGroupBOTTestbot. Next Step 7 Previous Step The username must be unique for each bot. If the username you enter is invalid you will recieve a warning and you can pick a different username Once the bot creation is finished sucessfully you will receive a BOT token used to access the Telegarm HTTP BOT API (Marked in red text in the image). Next Step 8 Previous Step If you misplace this token you can always return to the chat window for BotFather to view it.Once you noted down your token key please click on the link provided by BotFather to continue. Once you click on the provided link you will be taken to a new chat window. To continue the setup click the ”Start” button located at the bottom of the chat window. Next Step 9 Previous Step Once the button is clicked the bot will be initialized. Next Step 9 Previous Step To allow the BOT to receive messages from your group, Privacy mode of the BOT needs to be disabled. Next Step 10 Previous Step To disable it, return to the BotFather chat window and execute the following commands / actions: a. type /mybots Next Step 10 Previous Step b. click on the BOT you want to configure Next Step 10 Previous Step c. click on BOT Settings Next Step 10 Previous Step d. click on Group Privacy Next Step 10 Previous Step e. click Turn off Note: Privacy mode needs to be disabled before adding BOT the the group. Next Step 11 Previous Step Click on the link of your BOT displayed in the message from the BotFather above (t.me/MyGroupBOTTestbot) and click the button Start To allow the BOT to monitor group memebers BOT needs to be assigned to your group as administrator. While in the group, click on the group name in the header Next Step Assign the BOT to Telegram Group 1 Previous Step To assign BOT to your group, please follow the instructions below: Next Step 2 Previous Step Click the button Add member and enter name of your BOT. Select the BOT from the list and click Next. Next Step 2 Previous Step After the BOT is added as group member, click of group name in header to display group details and double check that BOT has access to messages as on the screen below: If that is not the case, remove the BOT, disable privacy mode as described in step #10 of Creating Group BOT. To run the service, you first need to download the source code, install dependencies and configure the service. Download or clone the code available on github link. Next Step Download and install service 1 Previous Step You need to have node.js, npm and mysql database installed on your computer or server. Next Step 2 Previous Step Run npm install in root folder (or from the download location for windows) Next Step 3 Previous Step Create database and import database schema from file bot_db.sql located in folder db. Next Step 4 Previous Step Open configuration file ts located in src/environments folder and set following parameters a. Update database connection details by entering database host, port, name, username and password b. Enter BOT token obtained in step #8 or Creating Group BOT c. Enter Chat Id of the group you ant to monitor. To retrieve Chat Id, click "Next Step". Next Step 4 Previous Step To retrieve Chat Id, do the following: I. send one message to your group as owner of the group II. call the url below in the browser: https://api.telegram.org/bot#botToken#/getUpdates Note: Replace #botToken# with your BOT token obtained in step #7 or Creating Group BOT III. You will find Chat Id within parameter chat.id as shown on image on the left IV. Set your Admin’s details. You can defined multiple admin entries Next Step 5 Previous Step Start the service by running command in the root folder: node node_modulests-nodedistbin.js src/bot.ts Next Step 6 Previous Step Now proceed to Telegram and configure as you wish. Type /start to get a list of available commands. Proceed to Configuration Guide CONGRATULATIONS! Previous Step YOUR BOT IS NOW READY TO BE USED LIVE IN YOUR GROUP!

Creating Group Bot

To create a BOT that will be assigned to group for active monitoring, use Telegram’s BotFather as described below:

  • Login to your Telegram account, if you do not have one you can
  • Click the button „Open in Web“
  • To get a list of available commands available type command /start in the chat window.
  • To create a new bot type the command /newbot in the chat to create new BOT
  • Once BotFather asks for the bot name, enter the prefered name of your new BOT, e.g. MyGroupBOT. Each bot name must be unique, if you type in a invalid name for your bot you will recieve a warning to change it to a new one.
  • Enter the username for your new BOT (it must end with the word bot), e.g. MyGroupBOTTestbot. The username must be unique for each bot. If the username you enter is invalid you will receive a warning and you can pick a different username
  • Once the bot creation is finished sucessfully you will receive a BOT token used to access the Telegarm HTTP BOT API (Marked in red text in the image). If you misplace this token you can always return to the chat window for BotFather to view it.Once you noted down your token key please click on the link provided by BotFather to continue.
  • Once you click on the provided link you will be taken to a new chat window. To continue the setup click the ”Start” button located at the bottom of the chat window.
  • Once the button is clicked the bot will be initialized.
  • To allow the BOT to receive messages from your group, Privacy mode of the BOT needs to be disabled. To disable it, return to the BotFather chat window and execute the following commands / actions:

a. type /mybots

b. click on the BOT you want to configure

c. click on BOT Settings

d. click on Group Privacy

e. click Turn off

Note: Privacy mode needs to be disabled before adding BOT the the group.

  • Click on the link of your BOT displayed in the message from the BotFather above (t.me/MyGroupBOTTestbot) and click the button Start

Assign the BOT to Telegram Group

To allow the BOT to monitor group memebers BOT needs to be assigned to your group as administrator. To assign BOT to your group, please follow the instructions below:

  • While in the group, click on the group name in the header
  • Click the button Add member and enter name of your BOT. Select the BOT from the list and click Next.
  • After the BOT is added as group member, click of group name in header to display group details and double check that BOT has access to messages as on the screen below:

If that is not the case, remove the BOT, disable privacy mode as described in step #10 of Creating Group BOT.

Download and install service

To run the service, you first need to download the source code, install dependencies and configure the service. You need to have node.js, npm and mysql database installed on your computer or server.

  • Run npm install in root folder (or from the download location for windows)
  • Create database and import database schema from file bot_db.sql located in folder db.
  • Open configuration file ts located in src/environments folder and set following parameters:

a. Update database connection details by entering database host, port, name, username and password

b. Enter BOT token obtained in step #8 or Creating Group BOT

c. Enter Chat Id of the group you ant to monitor. To retrieve Chat Id, do the following:

I. send one message to your group as owner of the group

II. call the url below in the browser:

https://api.telegram.org/bot<botToken>/getUpdates

Note: Replace <botToken> with your BOT token obtained in step #7 or Creating Group BOT

III. You will find Chat Id within parameter chat.id as shown on image below:

IV. Set your Admin’s details. You can defined multiple admin entries

  • Start the service by running command in the root folder

node node_modules\ts-node\dist\bin.js src/bot.ts

  • Now proceed to Telegram and configure as you wish. Type /start to get a list of available commands.

Congratulations! Your bot is now ready to be used live in your group!