Developer

IBM Maximo: integration with Twitter

IBM and Twitter
IBM Maximo and Twitter

 

I designed a solution to integrate IBM Maximo and Twitter to address a common requirement: to notify the users when something happen in IBM Maximo. For example an user group should be notified when an workorder change status. So to take advantage of social network I’m showing you a proof of concept about IBM Maximo and Twitter integration.

The solution is based on Twitter4J library, aย  Java Twitter’s API library.

Here a brief presentation of IBM Maximo Asset Management:

 

Here a brief presentation of Twitter

 

So the Customer’s need was to notify the application users when a Work Order is created or when a Service Request is opened. The smart phone extensive use enables to users to the social networks , so my suggest has been to use Twitter inside Maximo.

This is the scenario

A Company has a Twitter account and it wants use the social network to communicate with own users.
The employees, business partners, operators, users are followers.
Maximo uses the Company’s twitter account
Users open a Service Request by a tweet using the Companyโ€™s Twitter account

This is my approach

Maximo leverages on Twitter4J library to get the Twitter timeline and to tweets the users.
Twitter4J is Java library to interact with the Twitter API
Twitter4J is Zero dependency, no additional jars required
Twitter4J use the built-in OAuth support

The high level design

 

Maximo Twitter architecture
Maximo Twitter Hi-Level design

 

Steps

Create a Twitter company account
Goto into apps Twitter and register a new application, Maximo is just another twitter app
I developed the java class Maximo4tw, using the MBOs framework.

To open a Service Request

Users tweet to Company account
The tweet mentions the Company Twitter account ( in this example @the_n0ise) with the hashtag #newServiceRequest

 

SR by smartphone
Open a Maximo Service Request by smartphone

 

To read the Maximo tweets

Users read the Compnay timeline
It’s possible write a tweet with the workorder number, the description and the status

Under the hood

Using the Twitter Factory Java class from Twitter4j library:

 

TwitterFactory tf=new TwitterFactory(cb.build());

twitter=tf.getInstance();

 

create a crontask to read the Twitter timeline, using Twitter4j library

 

Maxio crontask
Maximo CronTask for Twitter

 

This is the crontask code:

public void run() {

authTwitterApps();

try {

  Query query = new Query("#newServiceRequest");

  QueryResult result;

  SRSetRemote srSet = (SRSetRemote)MXServer.getMXServer().getMboSet("SR", MXServer.getMXServer().getSystemUserInfo());

  do {

   result = twitter.search(query);

   List<Status> tweets = result.getTweets();

    for (Status tweet : tweets) {    ...

 

To send a tweets from Maximo when a WorkOrder status change:

public Status sendTweet(String tweet) {
Status status = null;
try {
status = twitter.updateStatus(tweet);
} catch (TwitterException te) {
te.printStackTrace();
}

 

Your comments and suggestions are welcome.

Related Articles

10 Comments

  1. Which jar do you need ? The Twitter4j.jar is available on-line.
    I can’t give you the businessobject.jar with my custom class but you can copy my code on-line ๐Ÿ™‚

  2. hello can you help me do this task please? please write me private message

Back to top button