SDK и примеры

Примеры

SDK и примеры

Минимальные примеры без SDK: чистый HTTP.

Bot API · Python long polling

import requests, time

TOKEN = "botYOUR_HEX"
BASE = f"https://forevormess.com/bot-api/{TOKEN}"
offset = 0
while True:
    r = requests.get(f"{BASE}/getUpdates", params={"timeout": 25, "offset": offset}, timeout=30)
    for u in r.json().get("result", []):
        offset = u["update_id"] + 1
        msg = u.get("message")
        if not msg: continue
        chat_id = msg["chat"]["id"]
        requests.post(f"{BASE}/sendMessage", json={"chat_id": chat_id, "text": "pong"})

Account API · curl

curl -sS https://forevormess.com/api/v1/account/me \
  -H "Authorization: Bearer fm_live_..."

curl -sS https://forevormess.com/api/v1/account/chats \
  -H "Authorization: Bearer fm_live_..."

Создать API ключ →