Hi Hemanth,
Adding a Copilot agent to a Teams group chat programmatically is possible, though it requires some setup since there isn’t a direct built-in Power Automate action for this yet. The recommended approach is to create a custom connector in Power Automate that uses the Microsoft Graph API. You can call the endpoint POST https://graph.microsoft.com/v1.0/chats/{chat-id}/installedApps
with the app ID of your agent to install it in the chat. In your flow, you would first create the group chat, get the chat ID from the response, and then call the custom connector to add the agent.
Alternatively, you can use Power Automate’s HTTP action to run Teams PowerShell commands like Add-TeamsAppInstallation -ChatId "{chat-id}" -AppId "{agent-app-id}"
, or extend your bot using the Bot Framework/Direct Line API to add the agent to the chat.
Key things to remember: your service principal needs the Graph API permissions Chat.ReadWrite and TeamsAppInstallation.ReadWriteForChat, and you should handle rate limits and errors carefully. If creating a custom connector isn’t feasible, another workaround is to trigger an Azure Function via webhook from Power Automate to perform the Graph API call.
Official Documentation References:
- Install Teams apps to a chat using Microsoft Graph – shows how to add apps to a chat programmatically.
- Microsoft Graph tutorials: Power Automate – guide for creating custom connectors and using Graph API in Power Automate.
- Custom connectors in Power Automate – overview of creating and using custom connectors.
Thanks,
Karan Shewale.
*************************************************************************
If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.