Serverless Twitter bot which tweets out goals from the 2018 FIFA World Cup.
Serverless application built using IBM Cloud Functions (Apache OpenWhisk).
Powers the WC2018 Goals Twitter account.
This project has two serverless functions goal_tracker
and twitter
.
goal_tracker
is connected to an alarm trigger running every sixty seconds. It retrieves all goals for live matches using this API. If new goals are returned, it invokes the goal
trigger with details.
twitter
is connected to the goal
trigger. It takes goal events and sends new tweets using the Twitter API.
Redis is used to cache goals previously seen by the goal_tracker
function.
If you want to deploy this project you will need an instance of the Apache OpenWhisk platform, access to a Redis database and credentials for a Twitter application.
-
Install The Serverless Framework.
npm install serverless
-
Clone Git repository.
git clone https://github.com/jthomas/goalbot.git
-
Install project dependencies.
cd goalbot && npm install
-
Create authentication credential for Redis and Twitter in
creds.json
file.{ "redis": { "host": "XXX", "port": "XXX", "password": "XXX" }, "twitter": { "consumer_key": "XXX", "consumer_secret": "XXX", "access_token_key": "XXX", "access_token_secret": "XXX" } }
-
Run the
deploy
command.serverless deploy