FastAPI integration for botas – zero-boilerplate Bot Framework bot hosting
Project description
botas-fastapi
A lightweight, multi-language library for building Microsoft Teams bots — this is the FastAPI integration package.
Wraps
botaswith a FastAPI server for zero-boilerplate bot hosting.
Installation
pip install botas-fastapi
Quick start
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()
Manual FastAPI wiring
For full control over routes, middleware, and server lifecycle:
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 {}
API
BotApp
High-level wrapper that composes a BotApplication with a FastAPI + Uvicorn server.
| 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 |
start() |
Start the FastAPI/Uvicorn server |
Options
BotApp accepts BotApplicationOptions plus these additional keyword arguments:
| Option | Default | Description |
|---|---|---|
port |
3978 (or PORT env) |
HTTP listen port |
path |
/api/messages |
Endpoint path for incoming activities |
auth |
Auto (enabled when client_id is set) |
Enable/disable JWT auth middleware |
Authentication options
Inherited from BotApplicationOptions (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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file botas_fastapi-0.3.25.tar.gz.
File metadata
- Download URL: botas_fastapi-0.3.25.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f60bcefc6dabd77a9d9136cbba0e559478f2d2e2d1f8a2ab52be9b6a620bdc2f
|
|
| MD5 |
8451439fff77576586739143ded2de90
|
|
| BLAKE2b-256 |
24477a50f391f3116e4bb22031ce8b03b5bb3940a66cead1188f4bf268e5c6a0
|
Provenance
The following attestation bundles were made for botas_fastapi-0.3.25.tar.gz:
Publisher:
CD.yml on rido-min/botas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
botas_fastapi-0.3.25.tar.gz -
Subject digest:
f60bcefc6dabd77a9d9136cbba0e559478f2d2e2d1f8a2ab52be9b6a620bdc2f - Sigstore transparency entry: 1364803710
- Sigstore integration time:
-
Permalink:
rido-min/botas@803e7e0dd71ed93a549a6e81eb2eb1176e15a595 -
Branch / Tag:
refs/tags/v0.3.25-alpha - Owner: https://github.com/rido-min
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
CD.yml@803e7e0dd71ed93a549a6e81eb2eb1176e15a595 -
Trigger Event:
push
-
Statement type:
File details
Details for the file botas_fastapi-0.3.25-py3-none-any.whl.
File metadata
- Download URL: botas_fastapi-0.3.25-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da84b5f91cc9c0ab6e0b0c4092cd25a06b2fce435bc360b998ef7b38db52e361
|
|
| MD5 |
ec33f45f27a28672f1f688d2ec3d9422
|
|
| BLAKE2b-256 |
57559b1d980af0ac00dd3d89c9665a28349c17de14337a11826dd92efb4efbcb
|
Provenance
The following attestation bundles were made for botas_fastapi-0.3.25-py3-none-any.whl:
Publisher:
CD.yml on rido-min/botas
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
botas_fastapi-0.3.25-py3-none-any.whl -
Subject digest:
da84b5f91cc9c0ab6e0b0c4092cd25a06b2fce435bc360b998ef7b38db52e361 - Sigstore transparency entry: 1364803724
- Sigstore integration time:
-
Permalink:
rido-min/botas@803e7e0dd71ed93a549a6e81eb2eb1176e15a595 -
Branch / Tag:
refs/tags/v0.3.25-alpha - Owner: https://github.com/rido-min
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
CD.yml@803e7e0dd71ed93a549a6e81eb2eb1176e15a595 -
Trigger Event:
push
-
Statement type: