Yammer topics tag trigger

My last post was about tags, this new one is also about tags. This time I will demonstrate how you can trigger a flow when a specific topics tag is used in recently posted Yammer message. That Yammer announcement will be used for crossposting the content as SharePoint News.

Inspiration

This question from Tono_Analyst2:

I want to automate the process of pulling the information from a new yammer post with a specific tag and creating a news post in a SharePoint site

Power Users Community thread: Trigger when a yammer post is created with a specific topic tag.

Yammer Conversations

First of all I like to point out that there is a Yammer Conversations web part out there which is perfectly capable on showing these kind of Yammer posts. You can even filter on specific topic.

yammerconversationswebpart

But there might be reasons why you still want to crosspost:
– Part of your SharePoint audience doesn’t have access to Yammer
– You want to present the same content in a different layout
– You want to integrate the Yammer announcements with your existing News Posts feed and not show a separate section with News.

Multiple tags

The first challenge was using the topics field from the trigger. The topics field is a collection where the label we want to use for filtering is stored in the name field. To retrieve the value you would have to use an index to refer to the name field of the correct item. However, you don’t know in which item the topic is stored.

yammer_crosspost

A workaround could be to convert the topics field to a string and just look for the label in the string value, in this example the topic CrossPost.

SavePage & Publish

When you are posting news you also have to take into account that news can be in a draft or published state. In this example we are creating the news post in draft state first.

With the SavePage we are adding and saving our content. With the Publish method we make sure the news posted is actually published.

Flow setup

crosspostannouncementfromyammer

1. Add a When there is a new message in a group trigger action, from the Yammer connector. Select your group and your network.

yammertrigger

2. Go to the settings of the When there is a new message in a group trigger action. Add a trigger condition. The expression can be found below.

triggercondition_yammer

3. Add a Send an HTTP request to SharePoint action. This is to create the draft news post in the Site Pages library. Below is an example of such a POST request. You can use the values from the parameters/uri, parameters/headers & parameters/body.

draftnewspost

4. Add a second Send an HTTP request to SharePoint action. Use the SavePage method to add content from the Yammer message on the news post page in the CanvasContent1 property. In this example I am only using the Title and the Message Text from the Yammer Announcement message.

Below is an example of such a POST request. You can use the values from the parameters/uri, parameters/headers & parameters/body.

newspost_savepage

5. Add a third Send an HTTP request to SharePoint action. Use the Publish method.

Below is an example of such a POST request. You can use the values from the parameters/uri, parameters/headers.

newspost_publish

That is it for the setup of this example. Then end result in SharePoint when you run the flow should look something like below.

published_newspost

Happy testing!

You may also like...

Leave a Reply

Your email address will not be published.

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