Twitter Adapter for OIC - Bot for Chuck Norris Tweets

When we think about Enterprise Applications, the automation of Tweets containing Chuck Norris jokes is not the first thought that comes to mind.....But that's exactly what I will demonstrate in this post :)

Some time ago I started to play with a raspberryPI, and to the lack of a better project I picked Python, Twitter API's, the NASA API and some other open API's with facts/jokes.

One of those API's was: https://api.chucknorris.io/jokes/random

It simply retrieves a random Chuck Norris Joke :)



So lets bring all this together in the Oracle Integration Cloud!

STEP1:

You need Twitter API keys.

Go to: https://developer.twitter.com/en/apps , create an APP and generate Keys, secret keys and access tokens.

STEP2:

In OIC Create a Twitter Connection. This is very straightforward - you will need the keys/tokens from step1 :

  • Consumer key
  • Consumer secret
  • Access token
  • Access token secret

Create a REST Connection for the ChuckNorris API.


Step3:

Create a scheduled Integration and drag the REST Adapter from step2.

The URI is /jokes/random and Action is GET. Specify that a response should be received.

Provide a Sample Response in the chosen format.


I got the sample response from https://api.chucknorris.io/

Example response:

{
"icon_url" : "https://assets.chucknorris.host/img/avatar/chuck-norris.png",
"id" : "fqKw-StkSCWI-BHEQ0SaiQ",
"url" : "",
"value" : "Chuck Norris knows what a mystery meal tasts like."
}

There is nothing to map as input as the REST GET call takes no parameters.

Drag the Twitter Adapter to the canvas.


Select the operation - In this case we want to Tweet.


Finally we want to map the output of the GET call into the TWEET input.



This is how the final Integration looks like - fast and easy.

Step4:

Activate and set up your schedule. I have it to run once a day, and when that happens, Chuck Norris delivers!



For more information on the OIC Twitter Adapter please check the documentation here.


Comments