Graph API returns AppDefinitionDoesntExist on POST installedApps

Samuel Charbonneau 0 Reputation points
2023-10-05T20:08:16.14+00:00

Hello,

I am trying to programmaticaly add a bot to a group chat.

Doing a POST call to : https://graph.microsoft.com/v1.0/chats/{{chatid}}/installedApps

{
   "teamsApp@odata.bind":"https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{{appid}}"
}

Yields :

{
    "error": {
        "code": "NotFound",
        "message": "NotFound",
        "innerError": {
            "message": "",
            "code": "AppDefinitionDoesntExist",
            "innerError": {},
            "date": "2023-10-05T19:42:40",
            "request-id": "<Redacted>",
            "client-request-id": "<Redacted>"
        }
    }
}

The private app is only installed for our tenant. I also tried with a version of the bot installed localy only for myself's Teams client with no success.

I have the permission TeamsAppInstallation.ReadWriteForChat.All showing in the portal.azure.

I can add the bot application manualy to the Teams chat through the UI without issue. Through F12 on chrome I can see the same appid for the bot that I am using in my POST InstalledApps call. I notice that the web interface of Teams is calling https://teams.microsoft.com/api/apps/part/amer-02/beta/chats/{{chatid}}/apps/entitlements endpoint which is not the graphapi.

Anyone has an idea how to make this work?

Thanks!

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,627 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,445 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Akash Jadav 85 Reputation points Microsoft Vendor
    2023-12-09T07:58:36.0933333+00:00

    Hi Samuel,

    Can you try referencing following documentation:

    https://learn.microsoft.com/en-us/microsoftteams/platform/graph-api/proactive-bots-and-messages/graph-proactive-bots-and-messages

    hope it can help you in implementation.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments