{"id":6322,"library":"botbuilder-integration-aiohttp","title":"Bot Builder Integration AIOHTTP","description":"This library provides the necessary components to integrate a conversational AI bot, built with the Microsoft Bot Framework Python SDK, into an aiohttp web application. As of version 4.17.1, the entire Bot Framework Python SDK, including this library, has reached End-of-Life (EOL). It is no longer actively maintained, supported, or receiving updates, and new development should avoid its use.","status":"abandoned","version":"4.17.1","language":"en","source_language":"en","source_url":"https://www.github.com/Microsoft/botbuilder-python","tags":["bot","microsoft","aiohttp","framework","conversational-ai","eol"],"install":[{"cmd":"pip install botbuilder-integration-aiohttp","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core web framework for integration. Version 3.9+ requires Python 3.8+ as of SDK 4.15.0.","package":"aiohttp","optional":false},{"reason":"Provides core abstractions like ActivityHandler and TurnContext, which are fundamental for bot logic.","package":"botbuilder-core","optional":false},{"reason":"Handles communication with the Bot Framework service.","package":"botframework-connector","optional":false}],"imports":[{"note":"The primary adapter for integrating Bot Framework with aiohttp.","symbol":"CloudAdapter","correct":"from botbuilder.integration.aiohttp import CloudAdapter"},{"note":"Used for configuring authentication credentials for the bot adapter.","symbol":"ConfigurationBotFrameworkAuthentication","correct":"from botbuilder.integration.aiohttp import ConfigurationBotFrameworkAuthentication"},{"note":"A utility middleware for handling errors within the aiohttp integration.","symbol":"aiohttp_error_middleware","correct":"from botbuilder.core.integration import aiohttp_error_middleware"}],"quickstart":{"code":"import os\nimport sys\nimport traceback\nfrom datetime import datetime\nfrom http import HTTPStatus\n\nfrom aiohttp import web\nfrom aiohttp.web import Request, Response, json_response\n\nfrom botbuilder.core import (\n    ActivityHandler,\n    TurnContext,\n)\nfrom botbuilder.core.integration import aiohttp_error_middleware\nfrom botbuilder.integration.aiohttp import CloudAdapter, ConfigurationBotFrameworkAuthentication\nfrom botbuilder.schema import Activity, ActivityTypes\n\n# Configuration\nclass DefaultConfig:\n    APP_ID = os.environ.get('MicrosoftAppId', '')\n    APP_PASSWORD = os.environ.get('MicrosoftAppPassword', '')\n    PORT = 3978\n\nCONFIG = DefaultConfig()\n\n# Create adapter. See https://aka.ms/about-bot-adapter to learn more about how bots work.\nADAPTER = CloudAdapter(ConfigurationBotFrameworkAuthentication(CONFIG))\n\n# Catch-all for errors.\nasync def on_error(context: TurnContext, error: Exception):\n    print(f\"\\n [on_turn_error] unhandled error: {error}\", file=sys.stderr)\n    traceback.print_exc()\n\n    await context.send_activity(\"The bot encountered an error or bug.\")\n    await context.send_activity(\"To continue to run this bot, please fix the bot source code.\")\n\n    if context.activity.channel_id == \"emulator\":\n        trace_activity = Activity(\n            label=\"TurnError\",\n            name=\"on_turn_error Trace\",\n            timestamp=datetime.utcnow(),\n            type=ActivityTypes.trace,\n            value=f\"{error}\",\n            value_type=\"https://www.botframework.com/schemas/error\",\n        )\n        await context.send_activity(trace_activity)\n\nADAPTER.on_turn_error = on_error\n\n# Define your bot logic\nclass EchoBot(ActivityHandler):\n    async def on_message_activity(self, turn_context: TurnContext):\n        await turn_context.send_activity(f\"You said: {turn_context.activity.text}\")\n\n    async def on_members_added_activity(self, members_added: [ChannelAccount], turn_context: TurnContext):\n        for member in members_added:\n            if member.id != turn_context.activity.recipient.id:\n                await turn_context.send_activity(\"Hello and welcome!\")\n\nBOT = EchoBot()\n\n# Listen for incoming requests on /api/messages\nasync def messages(req: Request) -> Response:\n    if \"application/json\" in req.headers[\"Content-Type\"]:\n        body = await req.json()\n    else:\n        return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE)\n\n    activity = Activity().deserialize(body)\n    auth_header = req.headers[\"Authorization\"] if \"Authorization\" in req.headers else \"\"\n\n    try:\n        response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn)\n        if response:\n            return json_response(data=response.body, status=response.status)\n        return Response(status=HTTPStatus.OK)\n    except Exception as e:\n        raise e\n\napp = web.Application(middlewares=[aiohttp_error_middleware])\napp.router.add_post(\"/api/messages\", messages)\n\nif __name__ == \"__main__\":\n    try:\n        web.run_app(app, host=\"localhost\", port=CONFIG.PORT)\n    except Exception as e:\n        print(f\"Error starting server: {e}\")","lang":"python","description":"This quickstart sets up a basic 'echo' bot using `botbuilder-integration-aiohttp` to expose a messaging endpoint via an `aiohttp` web server. It demonstrates how to initialize the `CloudAdapter` with authentication, define a simple `ActivityHandler` (EchoBot), and route incoming messages. To run this, save it as `app.py` and ensure `MicrosoftAppId` and `MicrosoftAppPassword` are set in your environment (or left empty for local development with the Bot Framework Emulator). Connect to `http://localhost:3978/api/messages` using the Bot Framework Emulator."},"warnings":[{"fix":"Migrate to alternative solutions for building conversational agents, such as the Microsoft 365 Agents SDK or other active bot development frameworks. Do not start new projects with this SDK. Support tickets will no longer be serviced as of December 31, 2025.","message":"The Microsoft Bot Framework Python SDK, including `botbuilder-integration-aiohttp`, has reached End-of-Life (EOL) with version 4.17.1. It is no longer actively maintained, supported, or receiving updates. New development should avoid this library, and existing projects should consider migration.","severity":"breaking","affected_versions":"4.17.1 and newer"},{"fix":"Ensure your development and deployment environments are using Python 3.8 or a later compatible version.","message":"As of SDK version 4.15.0, the underlying `aiohttp` dependency (version 3.9+) requires Python 3.8 or newer. Bots deployed on Python 3.7 or older will encounter dependency conflicts or runtime errors.","severity":"gotcha","affected_versions":"4.15.0 to 4.17.1"},{"fix":"Always configure `MicrosoftAppId` and `MicrosoftAppPassword` securely in production environments. For local testing with the Bot Framework Emulator, these can sometimes be left empty, but be aware of the security implications.","message":"Authentication is crucial for secure bots. Bots typically require `MicrosoftAppId` and `MicrosoftAppPassword` for production deployments. Running locally without these credentials might require specific adapter configurations to disable authentication checks, which is not recommended for production.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Familiarize yourself with Python's `asyncio` framework. Ensure all methods interacting with `TurnContext` or performing network/disk I/O are `async def` and called using `await`.","message":"The library is built on `asyncio`. All bot logic, especially I/O operations and callbacks within `ActivityHandler` methods, must be `async` and properly `await`ed. Failure to do so can lead to deadlocks, unresponsive bots, or silent failures.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}