How to set up your own _ebooks Twitter Bot

Why?

  • something to play with on Twitter
  • some Ruby code to play with
  • setting up a Twitter & Heroku app step by step

Get your Twitter archive

Install Ruby

Install twitter_ebooks

gem install twitter_ebooks -v 2.2.6  

Create a new Twitter account

Create Twitter app

Get credentials

Prepare Bot

ebooks new my_ebooks 
ebooks consume corpus/my_ebooks.csv  
ebooks gen model/my_ebooks.model 

Download additional files

Run the bot!

ruby run.rb

Hide the keys

gem install dotenv 


require 'dotenv'  
Dotenv.load(".env")

CONSUMER_KEY = ENV['EBOOKS_CONSUMER_KEY']  
CONSUMER_SECRET = ENV['EBOOKS_CONSUMER_SECRET']  
OAUTH_TOKEN = ENV['EBOOKS_OAUTH_TOKEN']  
OAUTH_TOKEN_SECRET = ENV['EBOOKS_OAUTH_TOKEN_SECRET']  

Bundle

gem install bundler  
bundle install  

Deploy using heroku

git init  
git add .  

git rm --cached .env  

git commit -m "First commit" 

heroku git:remote -a my-ebooks  
git push heroku master  
heroku plugins:install https://github.com/ddollar/heroku-config  
heroku config:push

Run

heroku logs -tn 5  

Thank you!

How to set up your own _ebooks Twitter bot

By Franziska Sauerwein

How to set up your own _ebooks Twitter bot

Source: @boodooperson http://blog.boodoo.co/how-to-make-an-_ebooks/

  • 3,047