Setting up Telegram Bot / DONE

Setting up Telegram Bot

  1. In your account you need to write to the contact @BotFather

  2. Click the Start button if the bot has not been launched yet.

  3. Write the command/newbot and follow the instructions in the bot to get the token

Install the received token

  1. Connect to your server via SSH or FTP

  2. Initiate a project

cd /var/www/exchanger-bot
git pull
npm i
npm run configure
  1. You need to configure token and username in the file /var/www/exchanger-bot/config/app_config.json

username is the name of the bot in the Telegram system, please specify the bot name without @

config/app_config.json
...
"bot": {
   "username": "usernamebot", 
   "token": "12345567:TOKEN"
}
...

4. Set up the domain in the configuration /var/www/exchanger-bot/config/app_config.json

Domain: www.exchanger.domain s provided as an example, please replace it with the domain of your site! If you have the exchanger installed on thewww please specify the domain with www

baseUrl: is formed according to the principle https://your_domain**/tg**

Example of how to fill out the config:

config/app_config.json
"http": {
...
    "baseUrl": "https://www.exchanger.domain/tg",
...
},
"exchanger": {  
  "baseUrl": "https://www.exchanger.domain", 
  "exchangerUrl": "https://www.exchanger.domain", 
  ... 
},
...

5. MongoDB Access:

Requires MongoDB on the server. If you install the bot on the same server where you have exchanger-api installed, take mongo:uri from the file exchanger-api/config/app_config.json

Specify in the configuration file/var/www/exchanger-bot/config/app_config.json MongoDB database accesses

config/app_config.json
...
"mongodb": {  
  "uri": "mongodb://localhost:27017/exchanger-bot"
},
...

6. Apply configuration changes (restart the service)

The PM2 Process Manager is required. You can install it with the command npm install pm2 -g

npm run start

Last updated