It is a Mulesoft ESB tweeter bot that posts a daily quote from the movies Lord Of the Rings (LOTR) using the language you want.
I'm using the nice API created by Ulrike Exner (http://rike.dev) that returns LOTR content. Thanks Rike ;)
This app integrates a LOTR content API and the Twitter v2 API, so you will need the following resources to run it. Everything here is free.
-
A twitter account.
-
A twitter developer account using Twitter API v2 updated to Elevated.
-
A Lord of the Rings (LOTR) API developer account.
- How-to: https://the-one-api.dev/sign-up
-
A Google Cloud Account and a key to use the service Google Translate.
-
Create a new file src/main/resources/local.properties with authorization info from twitter and LOTR APIs.
dailyquote.http.port: 8081
dailyquote.tweet.cron: 0 0 0,7,9,11,13,15,17,19,21,23 ? * * *
dailyquote.tweet.cron.timezone: 201
dailyquote.translation.enable: true
google.translatelanguage.host:translation.googleapis.com
google.translatelanguage.url: /language/translate/v2
google.translate.APIKEY: [your key]
google.translatelanguage.targetlanguage: pt
twitter.host: api.twitter.com
twitter.oauth.consumer_key: [value]
twitter.oauth.consumer_secret: [value]
twitter.oauth.access_token: [value]
twitter.oauth.token_secret: [value]
lotr.host: the-one-api.dev
lotr.authorization: [value]
You can use postman (https://www.postman.com/) to test it. The offline version of this tool is needed to performs tests against localhost.
- http://localhost:8081/api/quoteoftheday
- Returns a JSON object with a random quote
{
"quote": "'War? Yes. It affects us all. Tree, root and twig. But you must understand, young Hobbit......it takes a long time......to say anything in Old Entish... ...and we never say anything......unless it is worth taking......a long time to say.'",
"author": "'Treebeard'",
"source": "'The Two Towers '"
}
- http://localhost:8081/api/tweetdailyquote
- Actually post the quote using the twitter account and return a string with the quote posted.
"Yes, yes." - BILBO BAGGINS [The Fellowship of the Ring]
- Tweet quotes in several languages through Google Translator API or similar.
- Tweet a picture of the movie caracter owner of the quote along with it its quote.
- Write proper error handlings including sending e-mails to system admin when an exception happens.
- Integrate with Github actions to automatically build and deploy in CloudHub.