I want to install a tab app to a specific channel inside a team using graph api. The relevant documentation seems to only include adding apps to the team itself, not a specific channel. However, from the Microsoft Teams UI I seem to be able to do so.
I attempted to do a naive request:
https://graph.microsoft.com/v1.0/teams/{{team_id}}/channel/{{channel_id}}/installedApps
That mimics the working flow for teams using the standard convention for other API calls to a specific channel, but to no luck.
I also attempted to add it via:
https://graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/tabs
With a request body:
{
"displayName": "Your App Tab Display Name",
"teamsAppId": "YourAppId",
"configuration": {
"entityId": "YourEntityId",
"contentUrl": "YourContentUrl",
"websiteUrl": "YourWebsiteUrl"
}
}
But it returns a 500 error.
I have a channel named General
in my Teams group, that can be retrieved using below Graph API call:
GET https://graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/
Response:
Initially, you can call below Graph API query to get teamsAppId
of Forms application:
GET https://graph.microsoft.com/v1.0/appCatalogs/teamsApps?$filter=displayName+eq+'Forms'
Response:
To install a tab app to a specific channel inside a team, I ran below Graph request and got response like this:
POST https://graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/tabs
{
"displayName": "Forms Tab App",
"[email protected]": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{AppId_from_above_response}",
"configuration": {
"entityId": "YourEntityId",
"contentUrl": "YourContentUrl",
"websiteUrl": "YourWebsiteUrl"
}
}
Response:
To confirm that, I checked the same in Teams where tab application added successfully to channel like this:
Reference: Add tab to channel - Microsoft Graph