Microsoft Teams Bot unable to create conversation. Bot is not installed in user's personal scope.

Jose Ruz 0 Reputation points
2024-12-31T20:22:44.8133333+00:00

Hello everyone,

We are working on a Microsoft Teams Bot service to deliver notifications from our app (it is a one way communication bot)

We have integrated following services:

  • Graph:
    • POST login.microsoftonline.com/<tenant_id>/oauth2/v2.0/token in order to get a token and be able to get next services.
    • GET graph.microsoft.com/v1.0/users/<email> to get Microsoft User Id to be able to create a Microsoft Teams conversation (Bot=>User). Here we're sending the token obtained in the previous step and we have no problem finding users that are in the same tenant as bot is.
  • TeamsBot Services:
    • POST smba.trafficmanager.net/teams/v3/conversations We use this endpoint to create a one way conversation Bot => Microsoft Teams User and be able to send messages to that conversation. We're sending a payload as follows:
          
          {
            "members": [
              {
                "id": "<Microsoft User ID previously obtained>"
              }
            ],
            "bot": {
              "id": "<Our Bot ID obtained from entra.microsoft.com Application (client) ID"
            },
            "channelData": {
              "tenant": {
                "id": "<Tenant ID obtained from entra.microsoft.com Directory (tenant) ID>"
              }
            },
            "isGroup": false
          }
      
    • With previous service, we're able to get a conversation ID between Microsoft Teams Bot and a Microsoft Teams User
    • POST smba.trafficmanager.net/v3/conversations/<conversation_id>/activities where conversation_id is the Conversation ID obtained from the previous service. With this service we're able to send a message notification from our app to a user in Microsoft Teams App.

However, we added a few users (guests) to our Microsoft Teams app but when we're trying to follow previous process to send messages to those users this is what it is happening:

  • Find User By Email => Returns User info successfully
  • Create a conversation between Bot and User => Returns an error message as follows:
      {
           "error" => {
                 "code" => "BadArgument",
              "message" => "Bot is not installed in user's personal scope"
          },
          "status" => 403
      }
      
    
  • We've created a Permission Policy for our app and assigned to a private group in order to make sure every user added to that group has the bot installed in their Teams App namespace.

However this is not working for us.

We would like to know what we're missing to get Microsoft Teams Users messages from our Microsoft Teams Bot.

Thanks in advance.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,608 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,462 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,742 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Meghana-MSFT 3,906 Reputation points Microsoft Vendor
    2025-01-06T09:26:14.8866667+00:00

    Hi Jose Ruz - The above error occurs when the app is not installed in the user's personal scope. App needs to be installed in the user's personal scope for the bot to send messages. We tested this scenario with guest user and received the same error as you. Later, we installed the bot for the user, and we were able to get the conversation id successfully.

    1. Install the Bot for the Guest User: Before sending messages, you need to install the bot in the user's personal scope. https://learn.microsoft.com/en-us/graph/api/userteamwork-post-installedapps?view=graph-rest-1.0&tabs=http
    POST https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps
    Content-Type: application/json
    Authorization: Bearer {token}
    {
      "teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teams-app-id}"
    }
    
    
    
    1. Once the installation is successful, call the https://smba.trafficmanager.net/teams/v3/conversations endpoint again with guest user.
    2. You will get the conversation_id.

    Thanks,

    Meghana Peddamma


    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.


Your answer

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