I got past my immediate errors with a combination of two things:
- Aligning the bot service and app registration to Single Tenant authentication
- updating the adapter instantiation and process function to match what i was seeing on less deprecated code examples. Under the covers I'm sure this is doing something similar to creating the AUTH_CONFIG with the tenant id, but i haven't gone through enough of the code to know what exactly is the difference yet.
Not working:
from botframework.connector.auth import AuthenticationConfiguration
CONFIG = DefaultConfig()
AUTH_CONFIG = AuthenticationConfiguration(tenant_id="YOUR_TENANT_ID")
SETTINGS = BotFrameworkAdapterSettings(app_id="YOUR_APP_ID", app_password="YOUR_APP_PASSWORD", auth_configuration=AUTH_CONFIG)
ADAPTER = BotFrameworkAdapter(SETTINGS)
Working (including the messages def because it is small and i had to tweak that to work with the CloudAdapter wrapper):
Config has
class DefaultConfig:
""" Bot Configuration """
PORT = 3978
APP_ID = os.environ.get("MicrosoftAppId", "<app id>")
APP_PASSWORD = os.environ.get("MicrosoftAppPassword", "<app password>")
APP_TYPE = os.environ.get("MicrosoftAppType", "SingleTenant")
APP_TENANTID = os.environ.get('MicrosoftTenantId','<tenant id>')
from botbuilder.integration.aiohttp import CloudAdapter, ConfigurationBotFrameworkAuthentication
CONFIG = DefaultConfig()
ADAPTER = CloudAdapter(ConfigurationBotFrameworkAuthentication(CONFIG))
async def messages(req: Request) -> Response:
return await ADAPTER.process(req, BOT)