How to interact with the Yammer REST API

In this article I am going to demonstrate how you can use a Power Automate flow to add a user to a private Yammer Group use the REST API.

Taking a different approach

In the Power Automate community AArguello12 asked help with Adding a user to Yammer group.

As stated, the Yammer connector doesn’t have an dedicated action for adding members to a group. However, it is possible to manage the groups via the Office 365 Admin Center, since those Yammer groups are tied to Microsoft 365 Groups.

But I wanted to take a different approach, using the Yammer REST API. This article is a demonstration to show it is possible 🙂

Register an App with Yammer

Before you continue to the Power Automate setup you need to be able to communicate with the Yammer REST API. Yammer has the option to Register an App for that. After you done that you can obtain the developer token.

Patrick Lamber has described the steps for registrating an app in Yammer in this great article about Accessing the Yammer REST API through PowerShell.

HTTP action with Bearer token

When the connection with the Yammer REST API is completed we can setup our Power Automate flow. In this case we are going to use an HTTP action.

1. Add a HTTP action. The method is POST and in the URI field I am using the group_membership.json endpoint.
addhttpactiontoyammer

2. In the Headers we are using the Developer access token we acquired earlier in the Register an App setup. In my example I actually stored that in a variable called YammerAccessToken.

3. In the body you can reference the Yammer Group and the user you want to add to that group. Be aware that the id is the Yammer id and Azure Ad User id.

Below is a public gist with the configuration I used in my HTTP action.

Thanks, but why?

Again, it’s probably not the easiest way of managing a group. But it does show that you can easily interact with the Yammer REST API via Power Automate. The Yammer API has a lot of different endpoints. So, for me this is just a stepping stone to other Yammer Power Automate integrations.

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.