Share via

Teams bot responds locally but fails after deployment

Visham Pati 40 Reputation points
2026-03-10T13:07:04.7933333+00:00

I have a Microsoft Teams bot that works correctly during local development. However, after deploying and installing it in Teams, the bot sometimes doesn’t respond to user messages. There are no clear errors in the Teams client.

{
  "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.16/MicrosoftTeams.schema.json",
  "manifestVersion": "1.16",
  "version": "2.1.0",
  "id": "[Moderator note: personal info removed]",
  "packageName": "com.workspace.notificationbot",
  "developer": {
    "name": "Workspace Automation",
    "websiteUrl": "[Moderator note: personal info removed]",
    "privacyUrl": "[Moderator note: personal info removed]",
    "termsOfUseUrl": "[Moderator note: personal info removed]"
  },
  "name": {
    "short": "NotifyBot",
    "full": "Workspace Notification Bot"
  },
  "description": {
    "short": "Notification and automation bot",
    "full": "Bot used to deliver operational notifications and allow users to query system status from Microsoft Teams."
  },
  "icons": {
    "outline": "outline.png",
    "color": "color.png"
  },
  "accentColor": "#4A6CF7",
  "bots": [
    {
      "botId": "[Moderator note: personal info removed]",
      "scopes": [
        "personal",
        "team",
        "groupchat"
      ],
      "supportsFiles": false,
      "isNotificationOnly": false,
      "commandLists": [
        {
          "scopes": ["personal"],
          "commands": [
            {
              "title": "health",
              "description": "Check service health status"
            },
            {
              "title": "notifications",
              "description": "List recent notifications"
            }
          ]
        }
      ]
    }
  ],
  "permissions": [
    "identity",
    "messageTeamMembers"
  ],
  "validDomains": [
    "[Moderator note: personal info removed]",
    "[Moderator note: personal info removed]"
  ]
}
Microsoft Teams | Development
Microsoft Teams | Development

Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Kudos-Ng 14,515 Reputation points Microsoft External Staff Moderator
    2026-03-10T13:59:47.9033333+00:00

    Hi Visham Pati,

    Thank you for posting your question in the Microsoft Q&A forum.

    Please note that Q&A forum is a public platform, and moderators will modify the question to hide personal information in the description. Kindly ensure that you hide any personal or organizational information the next time you post an error or other details to protect personal data.

    Since your bot is working locally but failing "sometimes" after deployment, it typically indicates an issue with the hosting environment or a timeout rather than a manifest error.

    Here are the most likely causes and how to verify them:

    1. The "Cold Start" Timeout (Most Common)

    Is the failure happening only when the bot hasn't been used for a while?

    Microsoft Teams expects a response from your bot within 15 seconds (and ideally within 5 seconds for the HTTP trigger). If your bot is hosted on an Azure App Service (Free/Shared plan) or Azure Functions (Consumption plan), it may go to sleep. 

    2. Review Production Logs

    Check your hosting logs (e.g., Azure Log Stream or Application Insights).

    • Look for 401 Unauthorized errors (authentication issues) or 500 Internal Server Error.
    • Ensure that the MicrosoftAppType is correctly set (e.g., MultiTenant or SingleTenant) if you are using the newer SDKs.

    Looking forward to your findings.


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Q&A Assist
    2026-03-10T13:07:21.5533333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The most common causes when a bot works locally but intermittently fails after deployment in Teams are:

    1. Endpoint or tunneling issues
    • When debugging locally, a tunneling service such as ngrok is typically used:
        ngrok http <port> --host-header=localhost:<port>
      
    • After deployment, ensure the bot’s messaging endpoint in Azure Bot registration and in the Teams app manifest points to a stable, HTTPS endpoint of the deployed service, not to a stale ngrok URL.
    • If ngrok or any temporary URL was used during testing and is still configured anywhere, messages may be routed to a dead endpoint, causing silent failures in the Teams client.
    1. Bot not correctly installed or present in the conversation
    • Bots must be part of the conversation roster to receive messages. If the bot is removed or not installed correctly in a team or chat, it will not receive messages.
    • For channels, the bot must be added to the team before it is accessible in any channel.
    • If the bot is not in the conversation roster, Teams APIs can return BotNotInConversationRoster and require the app to be reinstalled in that conversation.
    1. Channel behavior in Teams (mentions in channels)
    • In channels, the bot receives messages only when explicitly @mentioned, even in replies to its own messages.
    • If users type commands without @mentioning the bot, it will not receive those messages.
    • All channel messages that the bot does receive will include the @mention text; the bot code should strip the mention before parsing commands.
    1. Tenant or admin configuration
    • Apps must be enabled by the tenant admin for users to load and use them. If the app is not enabled for all relevant SKUs or policies, some users or contexts may not be able to interact with the bot reliably.
    1. Notification/proactive messaging storage issues
    • If the bot sends proactive notifications, ensure the notification installation data is valid and up to date:
      • Installations are stored in persistence storage (for local default, .notification.localstore.json).
      • If the bot ID or password changes, or local state is cleaned, stored conversation IDs can become invalid and cause errors such as Failed to decrypt conversation ID.
      • Clean the notification storage and have users reinstall or interact with the bot so new installation data is captured.
      • On some hosting (for example Azure Web Apps or Functions), local file storage is cleared on restart/redeploy, so notification targets can be lost; use shared storage in production.
    1. Reinstalling to refresh installation state
    • If the bot app was installed before the notification or bot service was fully running, the installation event may not have reached the service.
    • To refresh installation state:
      • Send a message to the bot (personal chat) or @mention it in a group/channel to re-establish correct installation information, or
      • Uninstall the bot app from Teams and reinstall it, which resends the installation event.
    1. Bot disabled or blocked
    • If the bot is disabled on the Teams channel in the Bot Dashboard, it will stop receiving messages.
    • Individual users can block the bot in personal chat, which prevents them from receiving messages even though the bot continues to send them.

    Practical checks for this scenario:

    1. Verify the Azure Bot registration messaging endpoint matches the deployed HTTPS endpoint and not a local/ngrok URL.
    2. Confirm the same bot ID in:
      • Azure Bot registration
      • App manifest botId
      • Deployed bot configuration (app ID and password).
    3. In Teams:
      • For channels: ensure the bot is added to the team and users are @mentioning it.
      • If messages stop, try uninstalling and reinstalling the app in that team or chat.
    4. If using proactive notifications:
      • Clear any stale notification storage and re-trigger installation by messaging or reinstalling the bot.
      • Use durable shared storage in production.
    5. Ask a Teams admin to confirm the app is allowed in app policies and not disabled for affected users or SKUs.

    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.