Moving message threads to different group using the Yammer API

Lucas Jellema
0 0
Read Time:1 Minute, 44 Second

At AMIS we are quite happy users of Microsoft Yammer. Days with 10 or more messages are no exception and since December 2009, we have assembled quite a history of over 8000 message threads. Because we have joined the Conclusion eco system and we will now share a Yammer Network at that level – built with our existing network at its core – , all our All Company messages would become ecosystem wide All Company messages. It seems like a better idea to create a new group AMIS-AllCompany that is intended for AMIS staff only, that will coexist next to (Conclusion) All Company. Ideally, all our existing messages are moved from group AllCompany to this new group AMIS-AllCompany.

I have been experimenting with the Yammer REST APIs over the last few days. They are documented here: https://developer.yammer.com/docs . However, there is no API for moving messages. Several community conversations were conducted around that topic: where is the REST API for moving messages? See for example: https://techcommunity.microsoft.com/t5/Yammer/Move-a-conversation-to-another-group/td-p/2439

There is no officially documented API for moving messages. However, the Yammer web client supports the operation.

image

By inspecting the the network calls made from the web client, I could easily work out that there is a Yammer API call for moving messages.

image

The id at the end of the URL is the thread id, the group_id parameter is the id of the destination group.

The corresponding Postman request looks like this:

image

and the code in for example Node.JS:

var request = require("request");

var options = { method: 'PUT',
  url: 'https://www.yammer.com/api/v1/threads/233823545/move_to_group',
  headers:
   { 
     Authorization: 'Bearer XXXX',
     'Content-Type': 'application/x-www-form-urlencoded' },
  form:
   { isMoveThreadToGroup: 'true',
     group_id: '17438976',
     undefined: undefined } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

The message threads keep streaming in, in the destination folder. And are leaving the All Company folder at the same time.

About Post Author

Lucas Jellema

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director and Oracle Developer Champion. Solution architect and developer on diverse areas including SQL, JavaScript, Kubernetes & Docker, Machine Learning, Java, SOA and microservices, events in various shapes and forms and many other things. Author of the Oracle Press book Oracle SOA Suite 12c Handbook. Frequent presenter on user groups and community events and conferences such as JavaOne, Oracle Code, CodeOne, NLJUG JFall and Oracle OpenWorld.
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Next Post

Building a RESTful Web Service with Spring Boot using an H2 in-memory database and also an external MySQL database

In a previous article, I talked about an environment, I prepared on my Windows laptop, with a guest Operating System, Docker and Minikube available within an Oracle VirtualBox appliance. In this article, I will create two versions of a RESTful Web Service Spring Boot application that, later on (in another […]
%d bloggers like this: