yammer

Share a message to another group using Yammer REST API and C#


I want to use Yammer REST API and C# to share a post to another group (not posting a new message but sharing existing post) from my C# application. Does anybody know how it can be achieved.

Thanks in advance.


Solution

  • The REST API for Yammer supports sharing posts. You must pass the parameter shared_message_id to share an existing message. The answer at Yammers REST API to Share a Post explains how to do this with Ruby, and I've shared below the Ruby code snippet used to share a post.

    require 'yammer'
    group_id = '123456'
    shared_message_id = '7890123'
    yam = Yammer::Client.new(:access_token => 'OAUTH_TOKEN')
    yam.create_message('Message text to accompany the shared post', :group_id => group_id, :shared_message_id => shared_message_id)
    

    The answer for C# will be the same as however you would make a new post in C#, but you will need to pass the shared_message_id parameter to the endpoint.