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?

Resources