…also known as building a Twitter bot. The logic behind the bot is as follows:

  1. Tweet survey responses in a form of a “Home is…”
  2. Engage other people by:
    1. Tweeting “What is home to you?” to the people who follow my bot and if they reply, retweet, their response right away
    2. Read all tweets on Twitter and search for mentions “my home is..” and retweet those hoping that people will follow the bot and engage in the conversation

More about each separately.

Tweet survey responses in a form of a “Home is…”
As I mentioned in my earlier post, I received close to 100 responses to my survey, where I asked people where is home to them. Gathering responses helped me create a list of short 137 tweets, which I put into json file.  Then I wrote the following code:

The code includes both general set up with Twitter and generating a random tweet from JSON file every 6 hours. Having 137 tweets and generating tweet every 6 hours means that I have material for 34 days.

Tweeting to people that follow me and retweeting their replies

At first bot was trying to retweet my posts to other people as well, that’s why I had to update the logic a bit.

Read tweets and retweet the ones mentioning “my home is…”
This one is a bit trickier. Twitter automation rules don’t allow replying / mentioning people who are not opt in for your application. It means that I can’t reply to random people (this could lead to my bot being banned). What I can do is rarely retweet those tweets, so my logic for this would be:

  • Read the tweets¬†and add them to queue
  • Once an hour pick one random tweet and retweet it

Code for this looks like this:

I’m going to do user test during Programming A2Z class and my questions for it are:

  1. How to better engage people? In other words, since replying to random people is not allowed, how to make sure that more people follow the bot?
  2. What could be other search terms (other than “my home is”)?
  3. How to generate more content?
  4. Is it worth including computer generated tweets from some dictionary? Or would it be already too complicated for one bot and is worth creating a separate one in the future?

I’m going to post feedback after A2Z class and the same questions will be valid for Hacking Story Frameworks class workshop, too.

Oh, and the bot can be found here.

Leave a Reply

Your email address will not be published. Required fields are marked *