The Telegram Bot is built on the Laravel framework. Detailed information on installation and configuration can be found on the official website.
The Telegram Bot does not have a separate control panel, data is retrieved from the exchanger via API. All settings are configured directly in the exchanger control panel.
1) Register a new bot using "@botFather" and copy its token (secret key).
2) Using "@userinfobot", find out and copy your "ID" (user identifier).
Dashboard API
1) Generate a secret key in the "Application Settings" - "Dashboard API Settings" section.
2) Fill in the list of trusted IP addresses.
Private API
1) Generate a secret key in the "Application Settings" - "Private API Settings" section.
2) Enable the following methods: "Exchange", "Reserve Request", "Submit Review", "User Registration".
3) Fill in the list of trusted IP addresses.
Webhooks
1) Generate a secret key in the "Application Settings" - "Webhook Settings" section.
2) Enable the following events: "Change User Status", "Change Verification Request Status", "Change Investment Package Status", "Change Order Status", "Change Reserve Request Status".
3) Fill the host input.
https://YOUR.DOMAIN/api/webhooks/exchanger
Before starting installation, create a text file and fill in the environment variables with your data.
Example configuration:
APP_URL=https://YOUR.DOMAIN APP_API_PREFIX= APP_TIMEZONE=Europe/Kyiv APP_LOCALE=en APP_KEY= QUEUE_CONNECTION=sync DB_DATABASE=exchanger_cms_telegram_bot DB_USERNAME=user DB_PASSWORD=12345 TELEGRAM_BOT_NAME=eechatiWake0ho_bot TELEGRAM_BOT_TOKEN=1234567890:AAE2hF7K9LmNoPqRstUvWxYzAbCdEfGhIjK TELEGRAM_ADMIN_CHAT_IDS=360634322 EXCHANGER_URL=https://demo.exchanger-cms.com EXCHANGER_DASHBOARD_API_SECRET_KEY=Fa8aexee0ohK5ohziu2IePhal6shei9z EXCHANGER_PRIVATE_API_SECRET_KEY=OR4iogohnah0meesiech5Ieb3aek9ohv EXCHANGER_WEBHOOK_SECRET_KEY=iaGh4ja5jeiHu0YohSho9ju8vahch7ei
| Environment Variable | Description |
|---|---|
| APP_URL | Application URL |
| APP_API_PREFIX | Prefix for API endpoints (optional) |
| APP_TIMEZONE | Timezone |
| APP_LOCALE | Default language (ru, uk, en) |
| DB_DATABASE | Database name |
| DB_USERNAME | Database user name |
| DB_PASSWORD | Database user password |
| TELEGRAM_BOT_NAME | Telegram Bot name |
| TELEGRAM_BOT_TOKEN | Telegram Bot token |
| TELEGRAM_ADMIN_CHAT_IDS | Telegram Admin ID (comma-separated) |
| EXCHANGER_URL | Exchanger URL |
| EXCHANGER_DASHBOARD_API_SECRET_KEY | Exchanger Dashboard API secret key |
| EXCHANGER_PRIVATE_API_SECRET_KEY | Exchanger Private API secret key |
| EXCHANGER_WEBHOOK_SECRET_KEY | Exchanger Webhook secret key |
Use the environment variables below for more advanced configuration.
Default values:
HTTP_CONNECT_TIMEOUT=3 HTTP_TIMEOUT=9 TELEGRAM_MAX_CONNECTIONS=1 TELEGRAM_SENDING_DELAY=500000 TELEGRAM_MAX_UPLOAD_FILE_SIZE=500 EXCHANGER_USER_AGENT=EXCMSTB EXCHANGER_CACHE_TTL=60 EXCHANGER_CURRENCY_SORT= EXCHANGER_CURRENCY_HIDE= EXCHANGER_DIRECTION_HIDE=
| Environment Variable | Description |
|---|---|
| HTTP_CONNECT_TIMEOUT | HTTP connection timeout (seconds) |
| HTTP_TIMEOUT | HTTP request timeout (seconds) |
| TELEGRAM_MAX_CONNECTIONS | Maximum simultaneous connections with the Telegram Bot |
| TELEGRAM_SENDING_DELAY | Delay when sending messages to users (microseconds) |
| TELEGRAM_MAX_UPLOAD_FILE_SIZE | User upload file size limit (kilobytes) |
| EXCHANGER_USER_AGENT | "User-Agent" header when sending requests to the exchanger API |
| EXCHANGER_CACHE_TTL | Cache lifetime for exchanger API requests (seconds) |
| EXCHANGER_CURRENCY_SORT | Currency identifiers for sorting (comma-separated) |
| EXCHANGER_CURRENCY_HIDE | Currency identifiers for hiding (comma-separated) |
| EXCHANGER_DIRECTION_HIDE | Direction identifiers for hiding (comma-separated) |
1) Purchase the Telegram Bot.
2) Download the archive with files and extract it into the root directory of your site.
3) Create a ".env" file (environment variables file) and fill it with the prepared data.
4) Install dependencies.
composer install --no-dev --optimize-autoloader --prefer-dist --no-interaction
5) Generate the application key.
php artisan key:generate
6) Run the database migration.
php artisan migrate
7) Set up the Telegram webhook.
php artisan telegram:setup-webhook
8) Optimize the application.
php artisan optimize -e views
9) Set up the task scheduler (CRON) for user "www-data" to run the command every minute:
* * * * * /usr/bin/php /var/www/YOUR.DOMAIN/artisan schedule:run >> /dev/null 2>&1
To install updates, replace the files, reinstall dependencies, and migrate the database.
Use the built-in command to simulate Telegram webhooks.
php artisan telegram:simulate-webhook
Use a prefix for API endpoints (APP_API_PREFIX) to hide the standard URL and restrict access to the site.
Example URL without prefix:
https://YOUR.DOMAIN/api/webhooks/
Example URL with prefix:
https://YOUR.DOMAIN/api/gaok5gee2ooMaegheepholiezeeC0pau/webhooks/
Example WAF rule for Cloudflare:
(http.host eq "YOUR.DOMAIN" and not starts_with(http.request.uri.path, "/api/gaok5gee2ooMaegheepholiezeeC0pau/webhooks/"))