{"id":4900,"library":"botframework-connector","title":"Microsoft Bot Framework Bot Builder SDK for Python (Connector)","description":"The `botframework-connector` library, part of the Microsoft Bot Framework Bot Builder SDK for Python (version 4.17.1), provides the necessary components for a bot to communicate directly with the Bot Connector service. This allows for sending and receiving activities (messages, events, etc.) to users across various channels configured in the Bot Framework Portal. However, the Bot Framework Python SDK reached its end-of-life with the 4.17.1 release and will no longer be updated, maintained, or supported through service tickets in the Azure portal. For new agent development, Microsoft recommends considering the Microsoft 365 Agents SDK.","status":"abandoned","version":"4.17.1","language":"en","source_language":"en","source_url":"https://www.github.com/Microsoft/botbuilder-python","tags":["bot","microsoft","azure","chatbot","sdk","conversational-ai"],"install":[{"cmd":"pip install botframework-connector","lang":"bash","label":"Latest Release"}],"dependencies":[{"reason":"Provides the core schema definitions for bot activities and objects.","package":"botbuilder-schema"},{"reason":"Microsoft Authentication Library for handling authentication with Microsoft services.","package":"msal"},{"reason":"Microsoft REST client runtime for interacting with RESTful APIs.","package":"msrest"},{"reason":"Used for JSON Web Token (JWT) handling, essential for authentication.","package":"pyjwt"}],"imports":[{"symbol":"ConnectorClient","correct":"from botframework.connector import ConnectorClient"},{"symbol":"MicrosoftAppCredentials","correct":"from botframework.connector.auth import MicrosoftAppCredentials"},{"note":"Schema objects like Activity, ActivityTypes, ChannelAccount, and ConversationParameters reside in the `botbuilder.schema` package, not directly in `botframework.connector`.","wrong":"from botframework.connector import Activity","symbol":"Activity","correct":"from botbuilder.schema import Activity"},{"symbol":"ActivityTypes","correct":"from botbuilder.schema import ActivityTypes"},{"symbol":"ChannelAccount","correct":"from botbuilder.schema import ChannelAccount"},{"symbol":"ConversationParameters","correct":"from botbuilder.schema import ConversationParameters"}],"quickstart":{"code":"import os\nfrom botbuilder.schema import Activity, ActivityTypes, ChannelAccount, ConversationParameters\nfrom botframework.connector import ConnectorClient\nfrom botframework.connector.auth import MicrosoftAppCredentials\n\nAPP_ID = os.environ.get(\"MicrosoftAppId\", \"\")\nAPP_PASSWORD = os.environ.get(\"MicrosoftAppPassword\", \"\")\nSERVICE_URL = os.environ.get(\"BotServiceUrl\", \"https://slack.botframework.com\") # Replace with your bot's service URL\nCHANNEL_ID = os.environ.get(\"ChannelId\", \"slack\") # Example channel ID, replace as needed\nBOT_ID = os.environ.get(\"BotId\", \"your_bot_id\") # Replace with your bot's ID\nRECIPIENT_ID = os.environ.get(\"RecipientId\", \"user_id\") # Replace with the recipient's user ID\n\nif not APP_ID or not APP_PASSWORD:\n    print(\"WARNING: MicrosoftAppId and MicrosoftAppPassword environment variables not set. Authentication might fail for production scenarios.\")\n\ntry:\n    credentials = MicrosoftAppCredentials(APP_ID, APP_PASSWORD)\n    connector = ConnectorClient(credentials, base_url=SERVICE_URL)\n\n    conversation_parameters = ConversationParameters(\n        is_group=False,\n        bot=ChannelAccount(id=BOT_ID),\n        members=[ChannelAccount(id=RECIPIENT_ID)],\n        # channel_data={\"tenantId\": \"your_tenant_id\"} # Optional: Add tenant ID for Teams, etc. if needed\n    )\n    conversation = connector.conversations.create_conversation(conversation_parameters)\n\n    activity = Activity(\n        type=ActivityTypes.message,\n        channel_id=CHANNEL_ID,\n        recipient=ChannelAccount(id=RECIPIENT_ID),\n        from_property=ChannelAccount(id=BOT_ID),\n        text='Hello World from botframework-connector!'\n    )\n    response = connector.conversations.send_to_conversation(conversation.id, activity)\n    print(f\"Message sent. Activity ID: {response.id}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Ensure APP_ID, APP_PASSWORD, SERVICE_URL, BOT_ID, RECIPIENT_ID are correctly configured and accessible.\")\n","lang":"python","description":"This example demonstrates how to use `botframework-connector` to directly send an activity (a 'Hello World' message) to a user in a specific channel. It initializes a `ConnectorClient` with Microsoft App Credentials (typically set via environment variables) and then creates a conversation to send a message. This library focuses on the low-level interaction with the Bot Connector Service, primarily for proactive messaging or direct API calls."},"warnings":[{"fix":"Migrate to the Microsoft 365 Agents SDK or another supported framework for new development. Existing bots will continue to function but without official support or updates. Support tickets will no longer be serviced as of December 31, 2025.","message":"The Bot Framework Python SDK, including `botframework-connector`, has reached its End-of-Life (EOL) with version 4.17.1. It will no longer receive updates, maintenance, or support through Azure portal service tickets.","severity":"breaking","affected_versions":"4.17.1 and later"},{"fix":"Upgrade your Python environment to Python 3.8 or a newer compatible version. This includes updating the Python version in your Azure App Service if deployed.","message":"Beginning with SDK version 4.15.0, `aiohttp` package version 3.9+ (a core dependency) now requires Python 3.8 or newer. Bots running on Python 3.7 or earlier will encounter compatibility issues.","severity":"breaking","affected_versions":"4.15.0 and later"},{"fix":"Always set `MicrosoftAppId` and `MicrosoftAppPassword` as environment variables for your bot. For local development, these might be optional for some configurations, but they are mandatory for production deployments.","message":"Proper authentication using `MicrosoftAppId` and `MicrosoftAppPassword` is critical for production bots. Misconfiguration or absence of these credentials will prevent your bot from communicating with the Bot Connector Service.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Understand the scope of `botframework-connector`. If building a complete conversational bot, combine it with `botbuilder-core` components to handle the full lifecycle of a conversation.","message":"The `botframework-connector` library is typically used for low-level interactions with the Bot Connector Service, such as sending proactive messages. For a complete bot experience (handling incoming activities, managing turn context, dialogs), you would usually integrate it with `botbuilder-core` and its `BotFrameworkAdapter`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}