SharePoint News Notifications in Teams

Yesterday at our Birmingham SharePoint and Office 365 User Group meeting, we had an informal open discussion about Microsoft Teams.  Nick Brattoli and I lead the discussion, with demos of Teams, and talked about best practices and adoption.  We asked a lot of questions to the group, about how they currently use it, what end users are doing in there, and any roadblocks to adoption.  The discussion and idea sharing was awesome.  We talked about the idea that Teams is really for intimate collaboration among groups of people, around things such as projects and for teams who work closely together.   Inherently, of course each Team that you have is also an Office 365 group, which is also a SharePoint site.  There does seem to be some confusion around a few things, like when to use Teams versus other things.  So then the question was asked “What do we use SharePoint for, if we’re getting the end users to use Teams?”.

There are several answers to that question, but the first thing I jumped in with, is that SharePoint is your intranet.  An intranet is where most users are reading information like news and departmental topics.  It’s mostly one-way information posted by communications departments and individual departments.  If users are in Teams all the time, you can still show them your SharePoint pages, too.  One way, is to add a new (SharePoint) tab in your Teams channel, that shows a page from that site.  Notice that even if you do not have a page called “News” in the site pages library, you can still pick it here, and it will display all of your news from the site.  Also, keep in mind that if the users have installed the SharePoint mobile app, they will receive notifications about News, from the app.  (and the news author will receive notifications about comments on their posts as well)

teams-sharepoint-news

Also, if you’d like to show news from your main intranet homepage, not just a page from the current site, you can use a tab called Website.  You can just use the URL to any page/site in your intranet.

In either of those cases, users can click the tab in Teams to take a look at the news / what’s posted on the home page.  But, that doesn’t address the concept of users being notified about content there, like new or updated pages.  Here’s where my solution comes in.  There’s a new Microsoft Flow action for Teams, called Post your own adaptive card as the Flow bot to a channel.  This will let you create a pretty, customized announcement / notification that will appear in a Teams channel.  I wasn’t sure what an adaptive card was, but decided to try it out. Remember, I’m not a programmer.

Just to keep it simple, I’ll start by showing you how to use this action in a Flow, just with a manual trigger, just starting with one of the out-of-box templates.

 

1.  Go to your Site Pages library where the news is that you’d like to post to Teams.  Click the Flow menu at the top, and choose Create a Flow.

create-flow

 

2.  Choose Post a message to Microsoft Teams for a selected file. This will open up the Flow for you to configure further.  Delete the action called Post message.

delete-flow-action

 

3.   Add the Microsoft Teams action called Post your own adaptive card as the Flow bot to a channel.  Pick the Team and Channel where you would like to post the notification.  There are two differences here.  First of all, you are configuring the layout using JSON instead of HTML, also the message will be posting as the Flow bot, instead of as the user who triggers the Flow.

teams-adaptive-card-flow-action

 

4.  This is where it gets fun.  I went to this site with Adaptive Card Samples, and picked this one called “Restaurant”.  Optionally, if you’d like to change a few things and tweak this template, you can click the button Try it Yourself.

adaptive-card-restaurant

Here is the Adaptive Card Designer:

adaptive-card-designer

Once it visually looks the way you want it, the next step is to bring it over to Flow, to put your SharePoint information in there.

Click the button at the top of the page Copy JSON.

 

5.  Go back to Microsoft Flow.  In the Message box you saw at step 3 above, paste the JSON code.  Using dynamic content from Flow, insert the information about the news, that you’d like to be displayed in the card.  See, here I’ve inserted the Title, first published date, Description, Banner Image URL, and also Link to Item.

teams-json-message

 

6.  Save the Flow, and try it out.  Go to your site pages library, and select a row. At the top, click the Flow menu, and choose the name of the Flow you just created, Post a message to Microsoft Teams for a selected file. Continue, type a message, and click Run Flow.

manual-run-flow

Over in Teams, here’s what appears.  When I click the More Info button, it takes me over to that page in the browser.

flow-adaptive-card-teams

Here’s the exact Flow that I used, that you can download and try with your own site and Teams.

Here’s a recommendation.  Tie this posting of the article, to a page approval workflow, so once the page is approved, it will automatically post.

Just use the out-of-of box page approval workflow.   You’ll need to do the “Configure page approval flow” button in the screenshot above if you haven’t already.  Then, go to the Flow that it creates, called Submit SharePoint page for approval.

Go to the spot where it has a condition for what happens when the page is approved.  Add this same action there:

sharepoint-page-approval-teams

Voila!  Oh, and tell me if you get Rick Rolled while building your adaptive card.

This went live 4/15 on Power Hour:

sharepoint-news-teams-flow-adaptive-cards

 

 

References:

Adaptive cards for Microsoft Teams, now available

Drag and drop designer for adaptive cards

Microsoft Teams Developer reference for cards

13 comments

  • Matthew Jablonski

    How did you get the banner image to show up in Teams? When I do it, using banner image it doesn’t show. Same as if it send it as an email, the image only shows in Outlook on the web, not the desktop client. Thanks! 🙂

    Like

  • Seems to only be related to the desktop clients. The images show in Outlook or Teams web apps.

    Like

  • Hey Laura. I finally got round to looking at cards (t’s been on my to do list for a couple of months). Your article was super-valuable in helping me get up to speed quickly. Like you, I don’t right code and JSON hurts my head (I understand it, but it still hurts).

    My next job, having got messages appearing in Teams , is to:
    a) work up some conditional JSON so that I can alter attributes such as Colour and Size based on metadata (So a severity 1 item shows with Color=Warning)
    b) work out how to extract all teh page content from a news item, including any additional links, format them nicely and push those to Teams
    c) see if there is a way to push notifications to individual chat rather than a Teams chat channel

    Thanks again. See you at Orlando maybe?

    Like

  • Have looked high and low for any explanation… after trying this myself, I keep getting the error;

    “The specified Teams flowbot adaptive card request is missing or invalid.”

    Something changed Flow recently or am I missing something. Flow is setup in the team and channel I’m working with.

    Like

  • This is a super helpful post. It’s a bummer images don’t show up in the Teams app, but it does show up in the web version. That being said, I’d really love for this to work in Yammer versus Teams. Any template or advice on how to do this?

    Like

  • I blogged about a workaround to show the images in the Adaptive Cards when using the Teams desktop application. It’s due to an authentication issue where your Desktop client has no access to the images.
    Workaround is to “download” the images and embed them using Base64, more info over at https://blog.yannickreekmans.be/sharepoint-news-notifications-in-microsoft-teams-using-flow-and-adaptive-cards/

    Like

  • When starting Flow it asks me for obligatory Message field. And finally the post in Teams is not interpreted as Adaptive Card but just code {“type”: “AdaptiveCard”,”body”: [{“type”:….
    Why? Does it mean Adaptive cards are not supported in our tenant?

    Like

Leave a reply or question

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.