| title | Add app to chat |
|---|---|
| description | Install an app to chat. |
| author | subray |
| ms.localizationpriority | high |
| ms.subservice | teams |
| doc_type | apiPageType |
| ms.date | 04/05/2024 |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Install a teamsApp to the specified chat.
Notes:
- If the chat is associated with an onlineMeeting instance, then, effectively, the teamsApp will get installed to the meeting.
[!INCLUDE national-cloud-support]
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
[!INCLUDE permissions-table]
Note
- The TeamsAppInstallation.ReadWriteSelfForChat, TeamsAppInstallation.ReadWriteForChat, TeamsAppInstallation.ReadWriteSelfForChat.All, and TeamsAppInstallation.ReadWriteForChat.All permissions cannot be used to install apps that require consent to resource-specific permissions.
- The Chat.Manage.Chat permission uses resource-specific consent.
POST /chats/{chat-id}/installedApps| Header | Value |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Content-Type | application/json. Required. |
The request body should contain the catalog generated app ID for the app catalog. For details, see teamsApp properties. The following table lists more parameters that can be used with the request body.
| Parameter | Type | Description |
|---|---|---|
| consentedPermissionSet | teamsAppPermissionSet | Set of resource-specific permissions that are being consented to. |
Note: The permissions consented to during the install must be same as the resource-specific permissions present in the teamsAppDefinition of the app. To get the application and delegated resource-specific permissions, see Example 7. If only delegated resource-specific permissions are present in teamsAppDefinition, permissions can be omitted in the body of this request.
If successful, this method returns a 201 Created response code.
The following example shows a request.
POST https://graph.microsoft.com/beta/chats/19:ea28e88c00e94c7786b065394a61f296@thread.v2/installedApps
Content-Type: application/json
{
"teamsApp@odata.bind":"https://graph.microsoft.com/beta/appCatalogs/teamsApps/12345678-9abc-def0-123456789a"
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 201 CreatedExample 2: Install app in a chat and consent to the resource-specific permissions required by the app
To get the list of resource-specific permissions required by the app, get the app from appCatalog, as shown in Example 7.
The following example shows a request.
POST https://graph.microsoft.com/beta/chats/19:ea28e88c00e94c7786b065394a61f296@thread.v2/installedApps
Content-Type: application/json
{
"teamsApp@odata.bind" : "https://graph.microsoft.com/beta/appCatalogs/teamsApps/2b524e28-95ce-4c9b-9773-4a5bd6ec1770",
"consentedPermissionSet": {
"resourceSpecificPermissions": [
{
"permissionValue": "OnlineMeeting.ReadBasic.Chat",
"permissionType": "Delegated"
},
{
"permissionValue": "OnlineMeetingIncomingAudio.Detect.Chat",
"permissionType": "Delegated"
},
{
"permissionValue": "ChatMember.Read.Chat",
"permissionType": "Application"
},
{
"permissionValue": "ChatMessage.Read.Chat",
"permissionType": "Application"
}]
}
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
HTTP/1.1 201 Created