You are currently on IBM Systems Media’s archival website. Click here to view our new website.


Time to Start Tweeting With TweetMe4i, Part 1

Setting Up Twitter

Now that TweetMe4i is installed on your IBM i we need to setup a Twitter account and Twitter application. Setting up a Twitter account that you intend to post to via software isn't as easy as it could be in my opinion. For that reason, I’ll document this process with many screen shots so you don't have to stumble through the process as I did.

First, visit the site and select a new user name, email and password, as shown in Figure 1. When you click the SignUp button, it takes you to a subsequent page where you confirm the information as shown in Figure 2. After you click the “Create my account” button, Twitter emails you to confirm your account and you’ll need to click the link in the email, as shown in Figure 3. Once you’ve created your account, you can go into the Settings area and declare that you only want approved followers to view your tweets by selecting the "Protect my tweets" checkbox as shown in Figure 4.

So far, we’ve only set up a traditional Twitter account, which is easy enough, but now we need to obtain what's called the OAuth access tokens, keys and secrets so we can authenticate ourselves from another software application (i.e. the one on our IBM i), and that process is a little more complicated. Figure 5 shows a browser pointing at, which is where we need to go to register our first Twitter application and obtain the aforementioned access tokens, keys and secrets. Figure 6 shows how I set up an application name of MowYourLawnITDept. Also, I selected that this is a “Client” application type and that we need “Read, Write, & Direct Messages” access. After you submit that page, you’ll then be presented with your applications setting page, which will have a section named “OAuth 1.0a Settings” as shown in Figure 7. Take note of the “Consumer key” and “Consumer secret” values as you’ll need to enter these on the IBM i in a future step. Also on that page, select “My Access Token” link as shown in Figure 8. You’ll be taken to a page that shows the “Access Token” and “Access Token Secret” as shown in Figure 9. Again, make note of these values so we can use them later.

Setting Up Your IBM i

At this point, you’ve completely configured both your Twitter account and Twitter application and also have all the values necessary to configure TweetMe4i on your IBM i server. The next thing we need to do is modify IFS file to have the values we obtained from Twitter so we can authenticate with their APIs. The file is required by the Twitter4J tool and is a very common way to configure Java applications using a name-value-pair approach. To edit the file use the following command:

EDTF '/java/tweetme4i/'

That will put into an editor as shown in Figure 10. Note the oauth.accessToken, oauth.accessTokenSecret, oauth.consumerKey and oauth.consumerSecret names. This is when you’ll need to paste the values you retained from the Twitter pages into their corresponding spot on the other side of the equal sign. I’ve blurred out my values so people don't use my account for testing. To save the file, select F2 and then F3 to exit. You’ve now completed the configuration of TweetMe4i on IBM i and are ready to run a test. As I mentioned, the TweetMe4i tool comes with both RPG programs and a command that you can use to send tweets to Twitter. Before we use the TWEETME4I command, make sure library TWEETME4i is in your library list. When it is, you can run the following as a test:

TWEETME4I TXT('Where are my feathers!?!')

If everything went well, you should see your Twitter post on the website by going to< your account name >(e.g., If you don't see your post, you should do a DSPJOBLOG to see what might have gone wrong. One issue that I came across early on is that Twitter doesn't allow you to repeatedly post the same message. To get past this during the testing stage, I’d alter my message slightly for each test (i.e., Test 1, Test 2, Test 3, etc.).

Aaron Bartell is Director of IBM i Innovation for Krengel Technology Inc. and an IBM Champion.



2019 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

New and Improved XML-INTO

Namespace support makes the opcode a viable option

Authenticating on the Web

The finer points of OpenRPGUI, Part 1

The Microphone is Open

Add your voice: Should IBM i include open-source RPG tools?

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
IBMi News Sign Up Today! Past News Letters