Teams + Power Automate = Automation awesomeness! With the new Teams connector (currently in preview), you can automate tasks with Power Automate and trigger events using Teams data. The Teams connector enables you to use in Logic Apps, Power Automate, and Power Apps.
Using flow with Teams
Power Automate can be used in these scenarios with Teams:
- Trigger flows from Teams messages
- List, run, describe flow from Power Automate bot
- Use flows with adaptive cards
- Create flows from within the Power Automate app in Teams
You can start with a blank flow or choose to create a new flow based on one of the popular Teams templates (Figure 1):
You can trigger a flow when keywords are mentioned in a chat or channel conversation and use actions to create a team, add a member to a team, and even create a basic team from a flow. Figure 2 shows some of the common triggers and actions available for the Teams connector:
Teams apps: Power Automate & Approvals app
There are two apps available to add into Teams: the Power Automate app and the Approvals app.
- Power Automate app: Automates Teams activities or connects to other apps and services using the Power Automate app in Teams. Create, manage, and edit Teams flows or All Flows directly within this app.
- Approvals app: Send, receive, manage, and share approvals in directly within Teams.
The Power Automate app in Teams has multiple tabs for different functions. The Home tab displays a list of all your Teams flows, and you can change the drop-down filter to display All flows:
The Create tab displays an embedded page with a list of categorized templates (Figure 5). You can choose from to create a new flow from a template, or you can click on the + Create from blank button:
Adaptive Cards for Teams
Adaptive Cards are platform-agnostic user interface snippets of used within Power Automate to share blocks of information or to collect data. They are created in JSON format and transformed into the native UI the adaptive card is being rendered in. You can design your own Adaptive Card and use the card in flow actions to post to a Teams chat or channel, or as a Flow bot to a user. If you want to collect data from an Adaptive Card, you can use the action to post an Adaptive Card to Teams and wait for a response:
When I’m designing Adaptive Cards, I like to use the free online Adaptive Cards Designer so I can edit and preview the card before committing to its use.
READ MORE: Overview of Adaptive Cards for Microsoft Teams
Teams App Template: Request a Team
A few years ago, Microsoft launched App Templates for Microsoft Teams, a gallery of pre-built templates you can easily deploy for Teams. One of the most common app templates organizations have deployed is an app to allow end users to request the creation of a new team. The Request a Team template provides a way to implement a create team request approval/provisioning process through a wizard-guided request form, embedded approval process, request dashboard, and automated team builds.
The Request a Team app template consists of the following:
- Power App: Surfaced in Teams with tabs and home screen.
- SharePoint lists: Three lists used to store the data for the Team Request Settings, Teams Templates, and Teams Requests.
- Microsoft Teams: A team for admins to approve team requests that get posted as Adaptive Cards from the flow.
- Power Automate flows: Two flows. One flow triggered from a button in the Power App to check if the team name is available. Second flow is used for the approval process of the request that sends an adaptive card to Teams and saves the response in a SharePoint list.
- Logic App: The Azure Logic App runs at a scheduled interval to read from the Teams Request SharePoint list and provisions a team for all requests that have been approved and not yet created. It sends an email to the requestor once the team is created.
When the app is deployed in your tenant, you can add the Request-a -team app as a tab in Teams:
The Power App will default to the Request a team screen which gives the requester a choice to create a team from scratch or create from a template:
The requester continues with the request through the wizard-guide and input all required fields in the app. On the Team information screen, they will provide a Team name and then click on the Check availability button which triggers the Check Team Availability flow that checks to see if the team name is available:
If the requester chooses to create a team from a template, they see a screen with a drop-down of templates to select. The template information is pulled from the data in the Teams Template SharePoint list:
The last screen of the wizard is the Review and submit screen, where the requestor can preview the information of their request and either go Back and make changes or click Submit to send the request:
The Submit button saves the data of the request to the Teams Requests SharePoint list.
When a new item is added to the SharePoint list, the Status defaults to Pending Approval and the Team Request Approval flow runs. The flow then posts an Adaptive Card to the target channel in the Request a Team Admins team and waits for the response for approval:
The approver has buttons to Approve or Reject the request. When a button is selected the Add a comment box displays with a Submit button:
When the logic app runs, it will read and process requests from the Teams Requests SharePoint list. It has steps to loop through and add owners and members (if requestor added members in the request) as well as check the template type of the request. The provisioning process takes around 5 minutes for each team it processes:
Once the team has been provisioned, the logic app sends an email to the requestor letting them know the team has been created as shown:
The team shows up in Teams for the owners and members with a welcome message posted from an action in the logic app:
I hope you enjoy my session at TEC on September 1st, as well as this companion article to help understand the integration with Teams and Power Automate. I encourage you to try out the Request a Team app template as well as many of the other Power Platform app template solutions available to download at https://aka.ms/TeamsAppTemplates. You can use the templates as is or modify any of them to fit your needs. Please note: if you encounter issues with the deployment please raise an issue in the GitHub repo.