A java webservice that checks if tweets are real or fake news. Uses Vertx for the webservice and Twitter API to verify tweets based on a username and a tweet.
This project won the CreateCon 2018 UK Hackathon, subsequently invited to Microsoft Corp in Redmond to build a beta version at One Week Hackathon 2018.
- Import the pom.xml file into IntelliJ/Visual Studio Code or an IDE of your choice
- Run the maven clean and install task.(via your IDE or command line). Command line instructions: (First check if maven is installed with the first command)
-
$ mvn -v
-
$ mvn clean install
Notes: This is what is happening while you are running these tasks: Essentially, if you follow the pom.xml file, as well as downloading dependencies, it will also create a jar file under the lib folder and a war file under this folder target/fakenewsalert-1.0-SNAPSHOT/WEB-INF/lib. You need a jar file and war file to deploy your service in the future.
-
The next thing you need to do is to get a Twitter App ID, App Secret, Token and Secret and put this into the Constants class See the "How to get started with the Twitter API" section on this page: https://developer.twitter.com/en/docs/basics/getting-started (It is preferable to store credentials somewhere secure like Azure Key Vault)
-
After this you can start your service. Run your main class "RestLauncher.java" which launches the Rest Service(using the vertx library)
-
Test the service locally using Postman
-
Use this GET Request endpoint to ping the service(as a healthcheck): http://localhost:8080/test
-
Use a POST request to check if a tweet is real or fake, endpoint: http://localhost:8080/verify, add this JSON payload to the body of the POST request. The Service should return a string with "real" or "fake" to determine whether the tweet is real or not.
{
"handle":"@similola",
"tweet":"This is a test tweet, playing around with the Twitter API (again). As you were :)"
}
