+17
-2
@@ -47,8 +47,16 @@ API endpoint `/send_message` находится в Telegram боте, поэто
|
||||
|
||||
```
|
||||
POST /send_message
|
||||
POST {WEBHOOK_PATH}/send_message
|
||||
```
|
||||
|
||||
Где `WEBHOOK_PATH` - путь из переменной окружения `WEBHOOK_URL` (например, `/testbot`).
|
||||
|
||||
### Примеры URL:
|
||||
|
||||
- **Локально:** `http://localhost:5005/send_message`
|
||||
- **Через reverse proxy:** `https://bot.aabpro.ru/testbot/send_message`
|
||||
|
||||
### Заголовки запроса
|
||||
|
||||
```
|
||||
@@ -93,7 +101,8 @@ API защищен секретным токеном, который перед
|
||||
import requests
|
||||
|
||||
def send_telegram_message(user_id, message):
|
||||
url = "http://localhost:5005/send_message"
|
||||
# Используем внешний URL через reverse proxy
|
||||
url = "https://bot.aabpro.ru/testbot/send_message"
|
||||
data = {
|
||||
"user_id": user_id,
|
||||
"message": message
|
||||
@@ -115,7 +124,13 @@ def send_telegram_message(user_id, message):
|
||||
### Пример использования из командной строки
|
||||
|
||||
```bash
|
||||
# Используя curl
|
||||
# Используя curl (через reverse proxy)
|
||||
curl -X POST https://bot.aabpro.ru/testbot/send_message \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Secret-Token: ваш_секретный_токен" \
|
||||
-d '{"user_id": 123456789, "message": "Привет!"}'
|
||||
|
||||
# Используя curl (локально)
|
||||
curl -X POST http://localhost:5005/send_message \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-API-Secret-Token: ваш_секретный_токен" \
|
||||
|
||||
Reference in New Issue
Block a user