From charlesreid1

Recently, I've began a project called Imaginary Friends. The premise of the project is to create a flock of imaginary robot friends on Twitter, and put them all in a Github repository so that you can clone my robot flock into your own flock of imaginary robot friends.

The process of making a Twitterbot begins by setting up your account to interface with Twitter. This is basically a paperwork step. The process to automate interfacing with Twitter requires three steps:

First, get a Twitter app set up. This provides a way for your imaginary robot friend to talk to Twitter. You'll get "app keys" from Twitter - special keys that say, "I am the owner of this app!" Second, get your Twitter account set up. This involves getting some keys associated with your Twitter account - again, special keys that say, "I am the owner of this account!"

Third, start autotweeting. Now that you've got your keys, you can give them to a Twitter API library, which can then use your app and pretend to be you on Twitter, and you can start interfacing.

Step 1 of 3: Creating an App

Registering Your App

The first thing you're going to do is create and register a Twitter app at dev.twitter.com (specifically, at https://dev.twitter.com/apps/new). In this case, your "app" isn't a mobile phone app, or a layer between a user and Twitter, your app is just a Javascript or Python script that automatically generates tweets and sends them out. But the way your app interfaces with Twitter in any of these use cases looks pretty much the same.

You're going to need a couple of pieces of information:

  • App name
  • App description
  • App website

We'll ignore the OAuth URL field, which is for people who want their user authorization (login) systems to talk to Twitter's user authorization system.

You will need to change one other setting to make your app capable of controlling a Twitter account. By default, apps have READ-ONLY permission, but you want READ-WRITE permission.

Here's what read-only permission means:

When a user decides to use an app, and grants permission to that app to use the user's Twitter feed, that app can now read a variety of information about that account, but that app cannot tweet as that user, or send direct messages as that user.

Here's what read-write permission means:

When a user decides to use an app, and grants permission to that app to use the user's Twitter feed, that app can now read information about the account, as well as send tweets as that user, modify the user profile, change the user picture, and so on.

Now, here's the ONE catch in this whole process: to create an app that has write permission, you will need to associate a mobile phone number with the account that owns the app.

A Caveat about Accounts

There are two ways to deal with your Twitter app via your account: The Easy Way, which ties ONE app to ONE account and ONE Twitterbot; and The Hard Way, which creates ONE app to a master account, and then allows an ARBITRARY number of Twitterbots to use that one app.

The Easy Way

If you go with The Easy Way, you can go to your Application Management page (probably at apps.twitter.com/app or dev.twitter.com), then click the "API Keys" tab at the top, and scroll all the way down to the bottom, where there is a section entitled "Your Access Token." If you generate an access token, this creates an account key for your account. And now you're all done!

The Hard Way

The hard way involves creating a multi-user Twitter application, which is described in detail on its own wiki page: Multi-user Twitter Applications

Step 2 of 3: Account Keys

Now that you've got an app and an app key, you need to find keys for your user account.



Flags