Link Dump


bot summit


Wikipedia: meet the man who has edited 3m articles - because he’s written editing bots.


How to spot a Social Bot on Twitter (2014.06)
Twitter bots grow up and take on the world (2014.08)



bot impersonation - identity theft ?


twitterbot with scraperwiki and IFTTT



Using Heroku

  • See Also publishing a heroku app
  • Will need to initiate an app.
  • Install environment settings (no doubt) (see below)
  • copy the environment settings locally
  • create the Procfile - which is probably
    worker node index.js
  • run locally using foreman start worker



Config file

In order to be able to commit to .git and not put your actual auth-tokens into the file, use something like this:


module.exports = {
    consumer_key:         process.env.CONSUMER_KEY,
    consumer_secret:      process.env.CONSUMER_SECRET,
    access_token:         process.env.ACCESS_TOKEN,
    access_token_secret:  process.env.ACCESS_TOKEN_SECRET,

    // static_lib:           (process.env.STATIC_LIB.toLowerCase() === 'true'),
    tweet_on:             (process.env.TWEET_ON.toLowerCase() === 'true'),
    log:                  (process.env.LOG.toLowerCase() === 'true'),
    seconds:              parseInt(process.env.SECONDS, 60),
    minutes:              parseInt(process.env.MINUTES, 1)


Using Google Spreadsheet with apps script

Using Google Spreadsheets for a generated text Twitter bot

  • updated article - uses new OAuth script required by Twitter changes
  • my (unmodified?) copy
  • solanasbot01 variant (private to me)
    • the “first” variation used the original code, but with a single row of apx 20 sentences.
    • Second variant had a single column, and modified code (which I should document).
  • NOTE: scripts (of at least this kind) will continue running on the Google server, even after the spreadsheet/script browser-tabs are closed.


google docs on apps-script


Darius Kazemi sources

How to make a Twitter Bot

How I built metaphor-a-minute


twitter-bot starter-kit - using grunt-init


Other resources


twitter bot on heroku - python
Five Steps To Build Your Own Random Non-Sequitur Twitter Bot


A Twitter Bot in 20 Minutes With Node.js


Basic Twitter-bot Etiquette


scrub output for “bad” words:


Underscore.js stuff (for templating)
Best Practices When Working With JavaScript Templates
Getting cozy with underscore.js
An introduction to underscore.js - official docs


Everything you need to know about underscore template is here. Only 3 things to keep in mind:


    <% %> - to execute some code
    <%= %> - to print some value in template
    <%- %> - to print some values with HTML escaped


That’s all about it.


Simple example:


var tpl = _.template("<h1>Some text: <%= foo %></h1>");


then tpl({foo: "blahblah"}) would be rendered to the string <h1>Some text: blahblah</h1>





TODO: move this to a dedicated page in WebDevelopment


Using Wordnik for bots

See Wordnik
See which uses multiple calls.



editing the text

Split into sentences
sorted by length


cat /etc/passwd | awk '{print length, $0}' | sort -n | awk '{$1=""; print $0 }'
Didn’t work on my windows system, but cat | awk | <file> worked, so then I fired it up in Emacs, where sort-numeric-fields did the trick. I then deleted the numbers at the front of each line: ^[0-9]*\s-
Well, I also only selected the lines that had < 140 chars.


Could do this “easier” in a node.js script.
Will look into it.
Or in emacs, I suppose....



Auth Issues

TODO: try the get_tokens.js tool from aparrish’s example-twitter-bot-node



I ran into some authentication issues and.... I’m still not sure how I resolved them. Initially, on Wednesday, I couldn’t get the app set to do read+write, said I needed a mobile phone, and twitter would crash when I tried to add one (I think because my mobile number is already connected an account. My _real_ one).


Anyway. Later on it worked, without prompting for mobile.
Second bot had no issues.


Third bot had the auth troubles again -- insisted I need a mobile.
Ultimately, I deleted the mobile from my main account and added it to the bot so I could authenticate.
Then I deleted the mobile and re-added it to my profile.


I was able to use the techniques in twitter app write access and bots after installing ruby. Can’t find this functionality in anything else at the moment... More notes on twurl


I... don’t know where I installed ruby. It only appears at home as part of Heroku. so, I added that to the path. OK?


NOTE: capture the consumer-key and consumer-secret from the bot-application created under the main account (mine).

  1. Get access token
    1. Go to and select the app.
    2. Select the Keys and Access Tokens tabs.
    3. Log out.
    4. alternatively, you might them stored in Passpack or Keepass or something


  1. Log in to bot-account.
  2. do the command-line to authorize this account
    1. twurl authorize --consumer-key "[consumer-key]" --consumer-secret "[consumer-secret]"
  3. copy the URL provided
    1. looks like
  4. paste into browser
  5. authorize the app
  6. enter the PIN back into the shell1
    1. NOTE: I thought the application wasn’t working because there was no prompt for the PIN.
    2. There isn’t any. Just start typing.
    3. twurl seg-faults for me in cmder. At work, anyway. On lunch.
  7. get the new values from the .twurlc file for your bot
    1. the .twurlc file was create for me in C:\users\<username>\ - but if you have a HOME environment variable, it could be elsewhere.
    2. Using Heroku? You’ll need something like the following to set the env-vars:
    3. or, edit the .env file directly if you have it
      1. the ACCESS_TOKEN_ and ACCESS_TOKEN_SECRET keys are the targets
      2. CONSUMER_KEY and CONSUMER_KEY_SECRET are the shared keys for the app



Consumer Key? Consumer Secret?

I don’t know why it’s called that in every blasted articled I’ve read, since Twitter (as of 2014.08) calls it the API Key and API Secret


Go figure.


alternative libraries




See Also

WordSalad.TwitterBotProject - in which I write some (surprise!) Twitter bots.
posts tagged bots on



Category tags

Twitter Bots MicroBlogging Automation OAuth Authentication Heroku Cloud



No comments yet.



Add Comment

 Your Message
 Enter value ← Have you entered the code number?