This eBook is ideal for anyone wanting to get a crash course into what can be achieved with Power Automate and Teams. It contains several examples to show how you can automate information gathering, improve engagement and communications within Teams.
This eBook is ideal for anyone wanting to get a crash course into what can be achieved with Power Automate and Teams.
It is especially relevant to makers or citizen developers who
- want to do a little bit more inside of Teams for their department or for the processes that they focus on.
- want to automate things that they’re doing every day,
- want to improve communication inside of teams.
This is also for Teams Admins or the champions in your company for Teams who
- want to see how far we can push teams and collaboration.
- want to explore the possibilities for mashing up different things inside the Microsoft stack to get the most out of them.
So why should we drive people to teams, and why should we bring Power Automate into the mix? Don’t Teams already do enough?
The idea of Teams is to bring everything into one central location. SharePoint sites and libraries already live behind the information that you see inside of Teams. Private Channels end up being SharePoint sites or sub-sites. Microsoft Teams is really bringing everything into one place to create a one-stop-shop for all of your communication, to work on your files, to connect with your team, and even have some fun using GIPHYs/ reactions/likes, etc. When we talk about mashing up teams with Power Automate, we want to do a few things.
Improve effective communication.
Pushing email messages automatically to Teams channels can help by ensuring that folks have the most relevant information right in front of them where they’re working now.
Automate information gathering,
Polls can be used to survey your team or to gain a company-wide perspective. Information gathering in Teams, as opposed to sending out an email and hitting reply all to get that information can be far more effective.
If you really want to get people who don’t always participate in the team more engaged, maybe they’re not into team chat because they’re busy, this allows you to leave the polls or the messages where people can catch up with them when they are ready. It doesn’t require you to ping somebody in chat and expects an instant response, instead, you can leave information for folks where they’re going to see it while they’re working.
Teams: More than just Social!
The first thing people think about when using Teams is chat, saving files, and having meetings, however, there’s a lot more to using Teams.
The picture below illustrates some of the things that you can do inside of teams, looking at the left rail.
- Activity: this will indicate when somebody has mentioned you (using @yourname) inside any of the teams that you are a part of.
- Chat: this is where you can chat with other individuals, groups or other teams
- Teams: this lists all the other teams that you have access to
- Calendar: this displays all the meetings that have been scheduled for you, even ones that don’t have a Teams call associated with them. It’s a one-stop-shop preventing you from having to go back to Outlook, just to check on your schedule. If someone’s in chat asking whether you are free, you can pop over to your calendar to check what you have scheduled.
- Calls: lists all your recent call activity, so you can see who you’ve been talking to.
- Files: this provides a way of linking back to SharePoint lists and documents.
By clicking on the ellipsis at the bottom of the left rail, we can look at the other apps that are available embedded inside of Teams. Things like Stream, OneNote, and Planner are available to you. They can be added as tabs on top of the teams that you are a part of providing a great way to access things in a context very quickly. One of the available apps is the Flow App, which will help connect Power Automate with Teams, which we will look at in more detail in this eBook.
Introduction to Power Automate
If you’re familiar with SharePoint designer workflows or any other type of workflow engine, maybe Nintex, then you will realise the power that a workflow engine can bring to your collaboration.
Power Automate is the workflow service included with Office 365 licenses. This means that everybody who’s licensed inside your tenant has access to make flows inside of Power Automate. This really bridges apps and services inside the Office 365 stack. So anywhere that you have data that you’d like to get to, you can check to see if there’s a connector inside of Power Automate already there waiting for you to leverage in order to get that data and do something interesting with it. This is anything from setting up approval to making messages out of your emails and sending yourself a notification when certain things happen. When you get emails from certain people when a document is uploaded, what do you do with that? When a new list item comes in, who approves that? You’re only limited by your imagination.
There are a few exceptions to what you can do with the out of the box license. Anything involving third party data, such as connecting to Azure end up being premium connectors, and there’s an additional cost associated with that. But by and large, if you’re inside of the Office365 stack, you can use the out of the box standard license that you get with Office365.
Whenever I start creating a flow, I always start from the data and then figure out:
- who needs to be notified?
- who needs to add approvals?
Thinking about the points where other people need to interact with the data that you’re using are good places to start when you’re initially creating a flow. Teams and Power Automate make a great combination when data, notifications and person to person interaction happens.
What are the ways in which we can leverage these two together?
We’re going to look at demos of all these use cases.
- Posting email content to Teams
- Posting messages to a channel (Starting with the data)
- Schedule messages from a list anytime we have an announcement using Adaptive Cards
- Using adaptive cards to poll people inside of a team to pull a survey together.
Note: There are many other ways that you can extend adaptive cards, however, they are outside of the scope for this eBook.
Posting messages to Microsoft Teams based on a trigger
Let’s go ahead and go over to Power Automate. To get there, you need to go to the Office.com dashboard and click on Power Automate. You can also go to the app launcher also known as the waffle and select Power Automate from there.
Initially, I have a manual trigger and one other step to post a message.
Before we go through the things we can do with “Post a message,” I’ll just expand the ‘+’ button and show you what’s possible inside the team’s connector.
Microsoft Teams is likely to appear in the top section as it’s a popular connector, however, to search for it type in teams and get to it that way.
Click on the Teams icon to review the possible actions. Looking at the actions section, we can get all the messages, post options as the flow bot, post messages, even create a channel, and get a Team. There’s a lot in here, and it keeps expanding as people use Teams and more use cases become available.
Clicking on the Triggers tab shows those that are available to us, such as “When a new channel message is added” or “When a new team member is added.” The latter being a great way of giving an onboarding experience. For instance, when somebody is added, there could be some information that they need to receive such as notifications inside their email. This helps with their journey and driving engagement.
Additional searches can be performed inside the Teams connector, to refine the results coming back from the list of actions inside that connector.
For this example, I have a manually triggered flow and a post message action. I selected the Projects channel as this is where I want the message to be posted.
I have a simple message. “This is a new message from Ashley! Global Con 2 Rocks!”. Expanding the advanced options, I added the subject, “Hello World!”
If you’re used to posting messages manually inside of Teams, using this method, you can add a subject, the message contents as well as having the flexibility of using additional formatting. Let’s save and test this flow.
Heading over to Teams, let’s check where and what was posted. Inside my marketing team. I’ll click on my projects channel. I can see that we’ve got a “Hello World” with the message I typed in Power Automate.
Sending Emails to Microsoft Teams using Power Automate
In this example, we’re going to send an email to a channel, but interestingly, there will be no Teams action inside this flow.
We have a manually triggered flow, and an action to get emails that comes from Outlook. I’m fetching any new and unread messages from my personal inbox. I will grab the top one for the purpose of this demo. Under advance options, we can change who it’s to, or who it’s from. We can also look for things that have attachments or not or anything that has high importance. We can also do a filter on the subject line.
All of this is powerful and will help you to pick and choose things that are coming into an inbox and refine your flow to post only those specific emails to Teams. Anything that needs visibility can be done this way. This is a great solution for avoiding junk mail and keeping the important information that is necessary inside the Team.
The next step is an “Apply to each” action. I get this dynamically because I’m pulling information from a get emails action, and flow doesn’t know whether I’m getting one or more back. Even though I’m setting this to the top one that’s going to come back, flow is still going to treat this like it’s an array of information. There are ways to break this, but I find that for flexibility, I prefer not to as I want to be able to expand on this later.
The “send an email action” uses Outlook. In the “To” field is the email for the channel inside of teams. The subject and email body both come from the “get an emails action.” So there is nothing in here that is specific to Teams as far as actions go, but we’re still interacting with Teams.
When we’re interacting with people inside a Team, we’re not interacting with the Team at the site level, we’re actually interacting at the channel level.
To find the email of a channel in Teams, click on the ellipsis for more options and click “Get Email Address.”
In the “Get email address” box, “Projects” is the channel name, “Marketing” is the Team name, and the actual email address is displayed inside the brackets as highlighted below. This is what you need to put inside the “To” field in your flow.
In Outlook, I have one unread message in my inbox from myself, which I expect to get posted to Teams.
Let’s save this and test it. You should receive a message when your flow runs successfully.
Before I head back over to Teams, I want to mention that we can look in the flow to make sure that the right email was posted into Teams by looking at all the information that’s coming back in the body. All the formatting is shown, which could be removed and the message reformatted in a different way. It all depends on what you want inside of Teams and how you want that to be presented.
For now, we’re just going to look at what has been posted In Teams.
You can see that it’s formatted like the original email. Using this with Power Automate is a cool way to take that onus off your project manager to have to send things. Imagine you’ve got a client or have someone in another department who you’re working with and you want to make sure that all the emails from that person get captured, flagged and displayed in Teams. This is a great way to do that because you can all see it in one place where everybody in the team can view it.
Anytime you want to get your hands dirty, go ahead and look inside Power Automate, see what’s available. There are so many connectors, and ways that you can use the information you have at your fingertips, it’s very easy to get started.
What is an Adaptive Card?
Adaptive Cards are used across platforms. Anytime that you’ve seen little popups that have all the extra information about a file or about a person, that is the same concept as the adaptive card that’s used inside of Teams. What’s sitting behind that is JSON. If you have experience using JSON anywhere else; inside of Power Automate or in other development activities, for example, this is going to be easy for you to get up and running with.
If you don’t have a lot of experience, that’s okay. There are some great resources out there that can allow you to copy and paste examples from sources such as Microsoft documentation and just use them inside of your flows. They’re easy to get started with, even if you don’t have a lot of experience. The only drawback here is that the flow app does need to be installed inside of Teams. I will show you how to do that. We’re also going to go ahead and build a poll together and see how that works. We’re then going to use that from a SharePoint list to automate some of these activities. Let’s jump into another Demo.
Adding Flow Bot to your Teams channel
In order to use adaptive cards inside of Microsoft Teams, you’re going to need to add the flow bot to your Team. There’s are a couple of different ways to do that.
- You can click on apps at the bottom of the left rail.
This will take you to the full list of apps available in Microsoft Teams that you can add. The one that we’re focused on is Flow so select that. There’s a little introduction and things you can do with this app if you’re not familiar with using Power Automate.
Note: this is still called Flow in Microsoft Teams and not Power Automate, however, they are the same application.
We can open this or we can use the drop-down and click “Add to a team.” Then choose the Team we want to add this to.
When we click on setup, we have either the choice to set up a tab inside the Team, or to set up a bot.
- We can add Power Automate to a team by coming to teams on the left-hand panel, choosing a channel and finally adding a tab to that channel.
You can see that flow is one of the first choices, but we could also search for it.
Select the Flow tile, and then click “Add.”
When adding the app, you can automatically create a post for the channel to let the members know about the new tab. This helps announce the addition and can drive people to come, view and engage with it.
We now have a flow tab, which is almost identical to how Power Automate looks when you load it up on Microsoft.com
Now that we’ve added Flow to Teams, we can do some cool things such as using the flow bot to post adaptive cards.
Adding an Adaptive Card to a channel
Again, I’m going to start with a manually triggered flow and use the action, “Post and Adaptive Card to a Team’s channel and wait for a response.” This means, when we post the card to the channel, we need to wait for someone to interact with that information before we proceed to the next step.
Based on the response, I’m going to send an email to myself containing the information that’s being returned. In this case, I’m posting a poll as part of the adaptive card and whatever the user chooses, will be emailed back to me. You could do several different things with this information, but for the purposes of this demo, we’re just sending an email. Let’s look at what’s inside.
Inside the adaptive card action, we’re choosing a team and a channel to post this to. As mentioned, we do have to deal with some JSON.
The cool thing about adaptive cards is there are a lot of samples already available.
For this example, I chose a poll and adapted it to suit my needs. We’re asking, will you attend the virtual happy hour? With a Yes, no, or unsure response. You can see that the answers are nested inside.
After we paste all the JSON into the message field of the adaptive card, we can select “Yes” to “Should update the card.” We also have a message at the end that we can include that will say something along the lines of “thank you for your response.” Let’s go ahead and test this.
Since the trigger is waiting for a response, this action is not going to proceed until we provide a response.
Let’s go over to teams and check out what’s happening.
Our new poll with the title and other details is available in the channel as expected. We also have a little notice about who has used Power Automate to send the notification and poll you. If you are using this as a service account, the service account will show up instead of your name. Let’s go ahead and answer yes, and then submit. The poll closes once I’ve answered it – no one else will be able to respond.
Heading back to Power Automate, we can see that now I’ve provided that response the flow has been completed.
To check the email that was sent, let’s head to my email inbox and see that this has been responded to, the response was “Yes” and you can also see the email of the person who responded.
Posting to a channel and waiting for a response is great if you’re looking to source a single response. As soon as somebody replies to that adaptive card, that answer will finish the flow.
Polling multiple users with a Team using Adaptive Cards
If you wanted to poll everybody privately inside of the team, you would need to direct the adaptive card to each and every person.
Let’s take a look at how to post a card directly to a user inside Teams chat. The flow starts again with a manual trigger, with the second step being “Post an Adaptive Card to a Teams user and wait for a response.” This will direct it to a user, as opposed to sourcing an answer from the channel.
The same JSON is used in the message field but a recipient is an individual person (in this example, myself) as opposed to a team. We’re using Teams as our platform, and this is going to end up being in the chat with the flow bots. I’ll be chatting with the flow bot who will post this message to me asking me to answer these questions.
I’ll also make sure “Show update card” has “Yes” selected because that will prevent me from thinking that I have not actually responded. I’m going to go ahead and save and test.
As in the previous example, the action is waiting for me a response. I’ll head back over to Teams and you can see that inside the chat, I have a notification in the bottom right-hand corner letting me know there is a new poll.
I also receive a notification inside chat that a card has been sent by the flow.
I have a few options which are shown when I expand the “What can I do? Option. This is to do with the fact that I’m inside the flow app. If I wanted to create a flow, I can come straight through this chat and work with the flow bot.
However, right now, I just want to respond to this poll. I’ll respond “Yes” and “Submit.” The poll will then close, as I have responded to it.
Heading back to Power Automate, we’ll notice that the flow has been completed.
To post this card to more than one person you just need to list out all of their names in the Recipient box. Then we can just bulk send out the adaptive cards.
Responses that are received can be handled later on in the flow with multiple different actions. This is also a great way to keep the answers anonymous. We don’t see who is being polled or what they have answered. Only the person who’s managing those answers can see them. This is useful if there is sensitive data or, or there’s something that you wouldn’t want other people to know that you’ve answered a particular way.
The last thing that I want to introduce is, how to use SharePoint to make this even more flexible. I mentioned before that in the community, there are a lot of different templates and sample dates that can be used with adaptive cards.
adaptivecards.io is a great resource where you can find plenty of documentation on how to use adaptive cards effectively. It extends on more than just Teams with a world of things to investigate including samples under the “Samples” tab.
There’s a bunch of samples here that will give you some creative ideas with the JSON templates. We’re not going to go into how to use templates specifically with dynamic data in this eBook. Still, it’s useful to know this resource exists if you want to experiment more with adaptive cards.
Using data from SharePoint in your Adaptive Cards
Let’s head back over to Power Automate and take a look at our final demo.
We’re using a trigger that comes from SharePoint, which is “For a selected item” from the “Announcements” list. I’ll head over to SharePoint and take a look at that list.
I’ve got a name for the item, and then I have “AnnouncementType”. This list is allowing me to store card JSON inside a multiline text field. If I open the “Poll for Virtual Happy Hour” we can see all the JSON is stored so that I can make use of this multiple times.
We’re setting up multiple templates that are reusable inside of your tenant and just storing them in SharePoint. For each one of these items in the SharePoint list, we could select one and then we can get the information that we need.
The “Get items” action finds all of the data we looked at, the card JSON, name, and type. We then have an action to “Post an Adaptive Card to a Teams channel and wait for a response”.
Instead of surfacing all of the JSON inside the message body, we can keep this nice and clean by using the card JSON, that comes back from the “Get item” action. This is dynamic, meaning whatever I sent into this flow by selecting a particular “AnnouncementType”, the card JSON, in that multiline text field is what’s being populated in the message.
This means that I can manage that JSON directly inside the list and save that to reuse. I don’t have to manage the JSON inside the flow, which makes this super flexible and easy to maintain. Choose a team and channel, just like we used for the first demo. We’re going to update the card so that once somebody responds to this, the card flips to closed and nobody else can answer it. Remember to save the flow.
This doesn’t get tested from Power Automate, we have to do this from SharePoint. You can do this by selecting an item and then using the “Automate” dropdown box.
Then choose the relevant ‘SharePointToTeamsAdaptiveCards’ and click “Run flow”.
We get the notification that the flow has started.
I’ll head back over to Power Automate, and you’ll notice the flow is running. The orange clock icon shows that this flow is still waiting for someone to respond to it.
The poll has appeared in the correct channel in Teams. I will submit a response to it, which will then allow it to close. No one else will then be able to respond.
The flow has now has run successfully.
Inside of the “Get item” step is the card JSON that we picked. This is everything that would have been inside the message body from the first example that we had. We’re keeping it clean and managing all the data inside of SharePoint in order to reuse it.
Here are some additional resources for you to take a look at. These are some great places if you want to dig in a little bit more into the references and understand how to make your own templates for adaptive cards. There are also samples for anything that you need to do from polling all the way to an expense report. I’ve seen some pretty cool stuff up there to get you started.
Teams Connector in Power Automate
Adaptive Card Designer
Introduction to Templating
There are also plenty of community resources. Plenty of people have been doing some really cool things with templates. If you search inside the community, I’m sure you’re going to find things that you’re looking for. Go ahead and use these links and see what really cool things you can do. Thank you so much for reading my E-book. It has absolutely been a pleasure to make this for you. There is so much great content out there, so dig in and learn something new.