cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerAppUser875
Frequent Visitor

Post to Yammer as Praise Post

Is it possible to post to Yammer using the praise post format, and can you add a post as another user?

5 REPLIES 5
Expiscornovus
Super User
Super User

Hi @PowerAppUser875,

 

You could use the Yammer REST API for posting a praise. I am not sure if the post as another user is possible though.

 

Below is an example code snippet for posting a praise.

This requires a HTTP connector action, which is a premium connector. You might need an additional license to be able to set this up.

 

1. Register an app in Yammer. Make sure you obtain the access token and use something like below in the body.

 

{
  "body": "(See+attached+praise)",
  "body_format": "PLAIN_TEXT",
  "message_type": "praise",
  "publisher_type": "yam.ui.publisher.global.PraisePublisher",
  "publisher_Source": "group",
  "feed_id": "@{variables('YammerDestinationGroup')}",
  "feed_view": "default",
  "feed_type": "group",
  "number_of_recipients": "1",
  "invited_user_ids": "",
  "group_id": "@{variables('YammerDestinationGroup')}",
  "sender_id": "@{variables('SenderUserId')}",
  "skip_body_notifications": true,
  "praise": "{\"comment\":\"Amazing job again\",\"icon\":\"thumbsup\",\"praised_user_ids\":[@{variables('PraisedUserId')}]}"
}

 

postpraise_inyammer.png

 

2. In a test group this will look like this

 

postpraise_inyammer02.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


AshMSport
Frequent Visitor

How did you retrieve the PraisedUserId and is it possible to have it dynamically set. Eg. it's entered in a People picker field in SP list and whichever user is entered gets praised.

Expiscornovus
Super User
Super User

Hi @AshMSport,


Yes, that should be possible. Use the e-mail property of that field in a GET user by email request of the Yammer REST API.


Below is an example of that.

 

Uri field which uses a person or group type column with the name Employee.

https://www.yammer.com/api/v1/users/by_email.json?email=@{triggerOutputs()?['body/Employee/Email']}

 

The id of the first result.

body('HTTP_-_Get_users_by_email')[0]['id']

 

getuser_byemail_yammer.PNG



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


This is brilliant. Thank you @Expiscornovus !

I was able to get it to work. Only caveat is the sender username/ID doesn't show up anywhere. Anyway to show it?

AshMSport_0-1660949225960.png

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,652)