Skip to main content

Telegram bot middleware for Steeper — intercepts updates and outgoing messages to sync with the Steeper platform.

Project description

Steeper

Telegram bot middleware that syncs incoming user messages and outgoing bot replies with the Steeper platform.

Installation

# Core (pick one extra for your framework)
pip install steeper[aiogram]     # aiogram v3
pip install steeper[telebot]     # pyTelegramBotAPI
pip install steeper[ptb]         # python-telegram-bot v20+

Configuration

Every integration requires three values:

Parameter Description
base_url Steeper backend URL (e.g. http://localhost:8000)
bot_id UUID of the bot registered in Steeper
bot_token Raw Telegram bot token from BotFather

Usage

aiogram v3

import asyncio

from aiogram import Bot, Dispatcher, Router
from aiogram.filters import CommandStart
from aiogram.types import Message
from steeper.integrations.aiogram import SteeperMiddleware

BOT_TOKEN = "123456:ABC-DEF..."

router = Router()


@router.message(CommandStart())
async def cmd_start(message: Message) -> None:
    await message.answer("Hello!")


async def main() -> None:
    bot = Bot(token=BOT_TOKEN)
    dp = Dispatcher()
    dp.include_router(router)

    steeper = SteeperMiddleware(
        base_url="http://localhost:8000",
        bot_id="your-bot-uuid",
        bot_token=BOT_TOKEN,
    )
    steeper.setup(dp, bot)

    await dp.start_polling(bot)


if __name__ == "__main__":
    asyncio.run(main())

pyTelegramBotAPI (telebot)

import telebot
from steeper.integrations.telebot import SteeperMiddleware

BOT_TOKEN = "123456:ABC-DEF..."
bot = telebot.TeleBot(BOT_TOKEN)

steeper = SteeperMiddleware(
    base_url="http://localhost:8000",
    bot_id="your-bot-uuid",
    bot_token=BOT_TOKEN,
)
steeper.setup(bot)

# ... register your handlers as usual ...
bot.polling()

python-telegram-bot v20+

from telegram.ext import ApplicationBuilder
from steeper.integrations.ptb import SteeperMiddleware

BOT_TOKEN = "123456:ABC-DEF..."
app = ApplicationBuilder().token(BOT_TOKEN).build()

steeper = SteeperMiddleware(
    base_url="http://localhost:8000",
    bot_id="your-bot-uuid",
    bot_token=BOT_TOKEN,
)
steeper.setup(app)

# ... register your handlers as usual ...
app.run_polling()

How it works

  1. Incoming messages — the middleware intercepts every Telegram Update, serializes it to the standard Telegram JSON format, and POSTs it to the Steeper webhook endpoint. Your handlers still run normally.

  2. Outgoing messagesBot.send_message is patched so that every bot reply is also logged to the Steeper bot-message endpoint.

Both operations are fire-and-forget: if the Steeper backend is unreachable, a warning is logged but your bot continues to work.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

steeper-0.1.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

steeper-0.1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file steeper-0.1.1.tar.gz.

File metadata

  • Download URL: steeper-0.1.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for steeper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5ff1438786734b228519ae769cd2e84d02ded7168a7a83f0fa3d81e60039a216
MD5 4afcb941aad71bba05feb7cfbb1d600b
BLAKE2b-256 9b967ef6e9376167eaed7566433060671d61b9cc391da573964a9dcef700c460

See more details on using hashes here.

File details

Details for the file steeper-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: steeper-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for steeper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b89493a6ebbba0f7daad36e15e3c5e82bd045bc14e38a51c28adb264b6f085d
MD5 df52c6179631241a990509bd7befc04f
BLAKE2b-256 2c9b5f09dcceb36f05a832852501dcad076163fbaeac1f40d07b9c5a8c357cdc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page