Blog Post

Viva Engage Blog
2 MIN READ

Calling Legacy Viva Engage (Yammer) APIs via an Entra application

aditijha's avatar
aditijha
Icon for Microsoft rankMicrosoft
May 09, 2025

The Yammer application platform that enabled access to legacy Viva Engage (Yammer) REST APIs via OAuth2 tokens will be officially retired on June 30, 2025. To ensure uninterrupted access, all customers must transition to using Microsoft Entra applications as soon as possible.

The good news? The legacy Yammer APIs are fully supported through modern, secure Entra apps — and getting started is easier than you might think.

This blog provides a step-by-step walkthrough for calling Yammer APIs using an Entra application with PowerShell 7, leveraging MSAL for interactive authentication. We will call /users/current.json - Yammer | Microsoft Learn API to fetch the details of the user, who completes the authentication flow.

Note:

  • The examples in this post assume you have PowerShell 7 and the MSAL module pre-installed.
  • If you're looking for a Postman-based guide to access Yammer APIs, you can find detailed instructions here.

Let’s dive into how you can make this transition smoothly and start using Entra-authenticated API calls today.

Step 1: Register an Entra App

For detailed information on Entra application registration flow, refer to this guide.

  1. Go to Azure Portal: https://portal.azure.com
  2. Navigate to: Azure Active Directory → App registrations → New registration
  3. Fill in the form:
    • Name: e.g., Yammer API Test
    • Supported account types: Choose based on your org (e.g., "Accounts in this organizational directory only")
    • Select platform: Choose “Public client/native (mobile & desktop)”
    • Redirect URI: Set the right redirect url, e.g., http://localhost 
  4. Click Register

 

Step 2: Configure the App

Authentication

  1. Go to the Authentication tab
  2. Under Advanced settings, set:
    • Allow public client flows → Yes
  3. Click Save

API Permissions

  1. Go to API permissions
  2. Click Add a permission
  3. Select Yammer

     

  4. Select Delegated → access_as_user
  5. Click Add permissions to save

Step 3: Prepare the PowerShell Script

Save the following as YammerAPI.ps1:

# Clear MSAL token cache
Clear-MsalTokenCache

# Define app credentials
$clientId = "YOUR_CLIENT_ID"
$tenantId = "YOUR_TENANT_ID"
$redirectUri = "http://localhost"
$scopes = @(" https://www.yammer.com/.default")

# Trigger interactive login
$authResult = Get-MsalToken -ClientId $clientId -TenantId $tenantId -RedirectUri $redirectUri -Scopes $scopes -Interactive
$token = $authResult.AccessToken

# Call Yammer API
$response = Invoke-RestMethod -Method Get -Uri "https://www.yammer.com/api/v1/users/current.json" -Headers @{Authorization = "Bearer $token"}
$response

 

Now, replace YOUR_CLIENT_ID and YOUR_TENANT_ID with values from your app registration.

Step 4: Run the Script

In PowerShell 7:

> pwsh "C:\Path\To\YammerAPI.ps1"

 

You will be prompted to sign in interactively. Once authenticated, the script will call the Yammer API and return your user info.

We’re looking forward to hearing your feedback and thoughts about using the legacy Viva Engage (Yammer) APIs via modern Entra-based authentication and how you’ll use it to better manage users, conversations, and communities within Viva Engage. Stay tuned!

 

Aditi is a product manager at Microsoft

Updated May 09, 2025
Version 2.0

1 Comment

  • Dhaval2702's avatar
    Dhaval2702
    Copper Contributor

    We previously used the Yammer Share Script (platform_social_buttons.min.js) to enable users to share articles directly from our application UI. This script was integrated into our front-end and provided a seamless sharing experience. However, the sharing functionality is no longer working, and the script appears to be deprecated or unsupported.

    Can you please confirm if this script is officially deprecated? If so, what is the recommended alternative to restore or replace this sharing functionality within a modern Viva Engage or Microsoft 365 environment?

    We are looking for a solution that allows users to share content to Yammer/Viva Engage groups directly from the UI, ideally with the ability to select a group. Any guidance or documentation on how to implement this using current APIs or supported methods would be greatly appreciated.