Post SharePoint updates to Microsoft Teams using Flow

In this post, we will look into how to post the SharePoint updates to Microsoft Teams using Flow. Currently Flow works only on the Office 365 platform. For the SharePoint on-premises, we need to use the alternate like SharePoint designer workflow, that's another topic for another day.



For this post we will post the custom list updates to teams channel, that is whenever a new item is added we will post an update that the new item is added along with its title. Lets get started with the Microsoft Teams,


Create Connector


As a first step we need to create a connector for the teams channel. Go to your favorite channel in teams where you want to post the SharePoint updates

Click on the ellipsis (...) and then select connectors.









Add an incoming WebHook connector, and provide the title for your connector. If you have image which you prefer to show in teams whenever a message is posted then upload that image here. I prefer to use the default image for this exercise.












Once you hit save, copy the url of the WebHook which we will use in our Flow to post the message.


Microsoft Flow



Lets get into creating the flow, go to https://flow.microsoft.com/ and click on My Flows. Let's choose create from blank. Give a desired title for the flow, I'm giving it "SharePoint to Microsoft Teams".





Next, go ahead and search for triggers. In this case search for SharePoint and select "SharePoint - when item is added". You need to provide the SharePoint site url and then select the list from the drop-down for which we will be posting the messages.





Click on next step and select add an action, in this step we will be using "HTTP" action, search for http and select the action. You need to select Post as method, and in the Uri field put the url we copied from incoming Web-Hook connector. In the headers, set the content type as 


{   "Content-Type": "application/json" }





In the body of the request, { "title", "New item added in SharePoint list", "text", "<<List item title>>"} in the text field I have used the dynamic content from the list. You can change the body as desired. 










Click on create and then done.





Create an Item in SharePoint list



Lets go ahead and test our flow, go the SharePoint list which selected in the flow creation process and create an item. Give a minute and check the flow you should be able to see the action successfully executed.




Microsoft Teams Channel



If everything goes well, we should be able to see the post in the Microsoft team's channel where we configured the Web-Hook connector.










That's it we have create a flow which posts updates to the channel whenever an item is created in SharePoint, we can change the action as desired for document add, update and other actions of SharePoint as well. 





Peace!








Comments