Search code examples
microsoft-teamsteams-toolkit

MS Teams bot created using Teams toolkit does not find installations or members


This bot is meant to send notifications to individuals (not channels or groups). Not meant to receive messages either.

The bot is working fine in local. The bot was working fine in dev initially.

But after a new deployment to dev, it stopped working as the bot returns members and installations as empty, even though I had previously installed the dev package to Teams. No change even after uninstalling and reinstalling the app.

Still works fine in local.

EDIT: Two things were done to solve my issue.

  • As the accepted answer suggested, I added Azure Blob Storage to the bot to persist storage.
  • I had commented out /api/messages endpoint thinking as it was not required as my bot did not require messages to be received. But it seems like this endpoint is also required for registering new app installations.

Solution

  • The default notification sample uses a local file .notification.localstore.json to store the connection.

    • In local, the file is written to you local file system so will be kept there until your manual deletion.
    • On Azure, the file is written to Azure App Service's temp folder, so will be cleaned up after the app restarted or failover or re-deployment.

    So it's recommended to use your own storage in production. See https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/notification-bot-in-teams?tabs=ts1%2Cts2%2Cts3%2Cts4%2Cjsts%2Cts5#add-storage