Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

A little python framework for building bots for eXpress

Project description


A little python framework for building bots for eXpress messenger.

Tests Styles Coverage Code Style Package version License


pybotx is a framework for building bots for eXpress providing a mechanism for simple integration with your favourite web frameworks.

Main features:

  • Simple integration with your web apps.
  • Asynchronous API with synchronous as a fallback option.
  • 100% test coverage.
  • 100% type annotated codebase.

NOTE: This library is under active development and its API may be unstable. Please lock the version you are using at the minor update level. For example, like this in poetry.

botx = "^0.15.0"


Python 3.7+

pybotx use the following libraries:

  • pydantic for the data parts.
  • httpx for making HTTP calls to BotX API.
  • loguru for beautiful and powerful logs.
  • Optional. Starlette for tests.


$ pip install botx

Or if you are going to write tests:

$ pip install botx[tests]

You will also need a web framework to create bots as the current BotX API only works with webhooks. This documentation will use FastAPI for the examples bellow.

$ pip install fastapi uvicorn


Let's create a simple echo bot.

  • Create a file with following content:
from botx import Bot, ExpressServer, IncomingMessage, Message, Status
from fastapi import FastAPI
from starlette.status import HTTP_202_ACCEPTED

bot = Bot(known_hosts=[ExpressServer(host="", secret_key="secret")])

async def echo_handler(message: Message) -> None:
    await bot.answer_message(message.body, message)

app = FastAPI()
app.add_event_handler("shutdown", bot.shutdown)

@app.get("/status", response_model=Status)
async def bot_status() -> Status:
    return await bot.status()"/command", status_code=HTTP_202_ACCEPTED)
async def bot_command(message: IncomingMessage) -> None:
    await bot.execute_command(message.dict())
  • Deploy a bot on your server using uvicorn and set the url for the webhook in Express.
$ uvicorn main:app --host=

This bot will send back every your message.


This project is licensed under the terms of the MIT license.

Project details

Download files

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

Files for botx, version 0.15.17
Filename, size File type Python version Upload date Hashes
Filename, size botx-0.15.17-py3-none-any.whl (119.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size botx-0.15.17.tar.gz (63.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page