Streaming and REST Twitter Clients for openFrameworks
- Twitter Streaming API client.
- Twitter Search API client.
- Easily extensible.
- Many API features implemented (e.g. Search, Tweet, Media Upload).
To get started, generate the example project files using the openFrameworks Project Generator.
API documentation can be found here.
In order to use the Twitter API with
ofxTwitter, you will need a Twitter developer account and a registered Twitter application in order to generate the required credential information. To do this:
- Create an account at twitter.com if do not already have one.
- Create a Twitter application on apps.twitter.com.
- Once you have created an application, choose the "Keys & Access Tokens" tab and make note of the following credential items:
- Consumer Key (API Key)
- Consumer Secret (API Secret)
- Access Token
- Access Token Secret
These credentials can be used with
ofxTwitter programmatically or by loading a JSON file. A template JSON credentials file is provided with each example in
bin/data/credentials.json. If you are working with multiple OF apps using the same credential info, you can just copy and reuse the same
Note that the credentials are loaded with this code, usually in the
Alternatively you can load credentials programmatically with the following:
ofxHTTP::OAuth10Credentials credentials("YOUR_CONSUMER_KEY_HERE", "YOUR_CONSUMER_SECRET_HERE", "YOUR_ACCESS_TOKEN_HERE", "YOUR_ACCESS_TOKEN_SECRET_HERE"); client.setCredentials(credentials)
Creating a Twitter Application
To create an application with
ofxTwitter you need credentials (see above) and (optionally) you need an SSL certificate bundle (See ofxSSLManager for more info) in your
bin/data folder. You will likely need to include the following files:
credentials.json: your Twitter app's consumer & access token information.
ssl/cacert.pem: a collection of trusted root certification authorities, needed for the SSL communication for the Twitter API.
Keep Your Credentials Secret
Be careful not to upload your
credentials.json file to a public Github repository. If you do, don't worry -- you can easily log on to apps.twitter.com and revoke your compromised credentials and generate new ones.
stable branch of this repository is meant to be compatible with the openFrameworks stable branch, which corresponds to the latest official openFrameworks release.
master branch of this repository is meant to be compatible with the openFrameworks master branch.
This project uses Semantic Versioning, although strict adherence will only come into effect at version 1.0.0.
Pull Requests are always welcome, so if you make any improvements please feel free to float them back upstream :)
- Fork this repository.
- Create your feature branch (
git checkout -b my-new-feature).
- Commit your changes (
git commit -am 'Add some feature').
- Push to the branch (
git push origin my-new-feature).
- Create new Pull Request.