Forum Discussion

chisr's avatar
chisr
Copper Contributor
Jun 25, 2023

Automatically add Azure teams bot with RSC permission to a group chat - from rest api / graph api

We use bot Azure with teams & graph API

We want to automatically create a group chat and install the bot on the group chat so we could receive all the messages to the webhook we defined on the bot.

in V1.0 we saw that when we try to install the bot on the group chat by installedApps we get an error because we put RSC in the manifest file (without the RSC we cannot get the messages from the group chat to the webhook - just if we mention the bot which we don't want to do)

so we try the beta version - where the RSC suppose to work with installedApps but when we try to install the app on group chat we get a FORBIDDEN error:

{
   "error": {
       "code": "Forbidden",
       "message": "Forbidden",
       "innerError": {
           "message": "",
           "code": "Forbidden",
           "innerError": {},
           "date": "2023-06-24T23:50:26",
           "request-id": "ce**9f",
           "client-request-id": "ce94**"
        }
    }
}

Body :
{
    "email address removed for privacy reasons":"https://graph.microsoft.com/beta/appCatalogs/teamsApps/[APP_CATALOG_ID]",
    "consentedPermissionSet": {
                                 "resourceSpecificPermissions": [                     
                                {
                                   "permissionValue": "ChatMessage.Read.Chat",
                                   "permissionType": "application"
                                },
                                 {
                                 "permissionType": "application",
                                 "permissionValue": "ChannelMessage.Read.Group"
                                }
                            ]                  
     }
}

actually, we saw that the bot after the installation can send messages but it does not get the messages with RSC .When we get the installedApps on this group chat the consentedPermissionSet is null (even after an additional update). When we manually add the bot to a chat, we get all messages as we need, without mention. But we need to add it automatic from our code..

How can we work with RSC and app installation on chat?

19 Replies

    • chisr's avatar
      chisr
      Copper Contributor
      yes, but the beta version seems to support this option - https://learn.microsoft.com/en-au/graph/api/chat-post-installedapps?view=graph-rest-beta&tabs=http.
      A new parameter `consentedPermissionSet` was added
      • Sayali-MSFT's avatar
        Sayali-MSFT
        Icon for Microsoft rankMicrosoft
        chisr -Have you tried to add the app in one-to-one chat?
        We will check this with engineering team regarding the groupChat and let you know, once we get any update.

Resources