Skip to main content
botas logo

botas

A lightweight, multi-language library for building Microsoft Teams bots — this is the core Python package.

For zero-boilerplate FastAPI hosting, see botas-fastapi.

Installation

pip install botas

Quick start (with FastAPI)

from botas import BotApplication
from botas_fastapi import bot_auth_dependency
from fastapi import Depends, FastAPI, Request

bot = BotApplication()

@bot.on("message")
async def on_message(ctx):
    await ctx.send(f"You said: {ctx.activity.text}")

app = FastAPI()

@app.post("/api/messages", dependencies=[Depends(bot_auth_dependency())])
async def messages(request: Request):
    body = await request.body()
    await bot.process_body(body.decode())
    return {}

Or use the higher-level botas-fastapi wrapper for a simpler setup:

from botas_fastapi import BotApp

app = BotApp()

@app.on("message")
async def on_message(ctx):
    await ctx.send(f"You said: {ctx.activity.text}")

app.start()

API

BotApplication

The core bot class — web-framework-agnostic.

Method Description
on(type, handler) Register a handler for an activity type (also works as a @decorator)
on_invoke(name, handler) Register a handler for an invoke activity by name (also works as a @decorator)
use(middleware) Add a middleware to the turn pipeline (runs in registration order)
process_body(body) Process a raw JSON body string

Authentication options

BotApplicationOptions fields (also resolved from environment variables):

Option Env variable Description
client_id CLIENT_ID Azure AD application (bot) ID
client_secret CLIENT_SECRET Azure AD client secret
tenant_id TENANT_ID Azure AD tenant ID (default: common)
managed_identity_client_id MANAGED_IDENTITY_CLIENT_ID Managed identity client ID
token_factory Custom async token factory (scope, tenant_id) -> str

Documentation

License

MIT

Download files

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

Source Distribution

botas-0.3.83.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

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

botas-0.3.83-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file botas-0.3.83.tar.gz.

File metadata

  • Download URL: botas-0.3.83.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for botas-0.3.83.tar.gz
Algorithm Hash digest
SHA256 8b40ef00895e3afcbd838a0566d2760cf867ca4dcfb42dd5f7faf00fcdfb1b91
MD5 2798cb3209613410437a4c7f4be26873
BLAKE2b-256 87337a9daf650dc6046874a0e03b39347f08edb8874201ad7a255c8590957bdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for botas-0.3.83.tar.gz:

Publisher: CD.yml on rido-min/botas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file botas-0.3.83-py3-none-any.whl.

File metadata

  • Download URL: botas-0.3.83-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for botas-0.3.83-py3-none-any.whl
Algorithm Hash digest
SHA256 82132b71a130132ad571f87e666bcba6f5fcee2a40122557ff8e47bb56e7af08
MD5 32178e534a0940c124c81798ba905ad2
BLAKE2b-256 9533801e91a1e795890fd836f9aefd169738d514ab4b53fced2a9578b0d9572f

See more details on using hashes here.

Provenance

The following attestation bundles were made for botas-0.3.83-py3-none-any.whl:

Publisher: CD.yml on rido-min/botas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.83 This release

2 files

0.3.82

2 files

0.3.80

2 files

0.3.78

2 files

0.3.72

2 files

0.3.71

2 files

0.3.69

2 files

0.3.61

2 files

0.3.33

2 files

0.3.31

2 files

0.3.25

2 files

0.3.18

2 files

0.3.6

2 files

0.2.3

2 files

0.1.80

2 files

0.1.77

2 files

Supported by

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