Sign up for our newsletter for the latest updates

Get the Skinny
on all things Vertech

Breaking news, fresh ideas, industry insights,
weekend escapades, it's all right here.

Integrating WinCC OA SCADA software with Yammer

December 6, 2017 / by Calvin Hamus

In a recent post we showed how to connect WinCC OA SCADA software to Slack. One reader asked if it was also possible to connect to Yammer, which is a similar collaboration too from Microsoft. As the reader stated so well, "Sometimes we just have to use the tool we have, not the best one." So to help make the most of a bad situation (just kidding) for this person, here is a follow-up post explaining the basics of connecting WinCC OA to Yammer.

The first step comes directly from Microsoft's documentation found at https://developer.yammer.com/docs/app-registration, because they do a very good job of explaining the finer details of the connection.

Step 1

Go to https://www.yammer.com/client_applications. Click on the “Register new App” button. Please note, when you create an app, this app will be linked to the Yammer network related to your user account. This is the network you will use to access, edit, and test your application.

Consider using a service account when registering your app at https://www.yammer.com/client_applications. i.e. “apps@yourcompany.com”. This will ensure your app continues to work if you or the app creator leaves the company.

For the redirect URI you will need to have an https enabled URL. I just used our company website because we really won’t be redirecting from inside of OA.

Yammer1.jpg

When you click continue, you will be given the following information. Keep these pieces of information available because they will be useful for the next few steps.

Yammer2.jpg

Step 2

You will need to register an Admin with the account. You can do this by going to this url in a web browser

https://www.yammer.com/dialog/oauth?client_id= [ :client_id ].

Replace [:client_id] with the client id from the previous step and then click Allow.

Yammer3.jpg

 

Step 3

Once you click allow you will be redirected to the Redirect URL you entered in the first step. In the URL in the web browser you will notice there is a code=xyz in the URL. Copy this down and keep it somewhere.

Yammer4.jpg

Step 4

Stay in the web browser and navigate to

https://www.yammer.com/oauth2/access_token.json?client_id= [ :client_id ] &client_secret= [ :client_secret ] &code= [ :code ]

Again, replace [:client_id] , [:client_secret], and [:code] with the the client_id and client_secret with the values from the first step. Replace [:code] with the code that you copied down in Step 3.

Your will be redirected to a page that looks like this.

Yammer5.jpg

 

Most of this has been cut off to hide my information. Copy this page and store it somewhere SAFE and HIDDEN. This is the access token to your Yammer account. If someone gets a hold of this, they can access ALL of your Yammer. The piece you will need from this is the token attribute.

Step 5

We can now open OA and go to a new or existing project. Open up a script and add in the following code. I attached this to a dpConnect so it will send any time a tag changes. The important pieces from this code are the mMappe needs to have a “body” piece. Also, the ‘headers’ mapping needs to have the Content-Type : application/json and the Authorization: Bearer YOUR TOKEN needs to be filled in.

workYammer(string dp, int a)

{

mapping m;

string s = "Hello from WinCC OA" ;

mapping mMappe = makeMapping("body","Hello from WinCC OA");

string s = jsonEncode(mMappe);

netPost("https://www.yammer.com/api/v1/messages.json", makeMapping("content",s, "headers", makeMapping("Content-Type", "application/json","Authorization", "Bearer YOUR TOKEN")),m);

DebugN(m);

}

And the end result will be...

Yammer6.jpg

 

This gets you connected. From here you can take this further to select the Yammer group, and do more automated things on the OA side to make this useful.

Topics: SCADA

    

Recent Posts

Subscribe to Email Updates