API authorization

All users must be authorized to interact with Twitter’s APIs. To become authorized, follow the instructions below to (1) make a Twitter app and (2) create and save your access token (using one of the two authorization methods described below).

1. Create an app

To gain access Twitter’s APIs, first go to apps.twitter.com and create a new app by completing the form fields (note: users must enter the value for Callback URL exactly as it appears below):

Name: Name of Twitter app e.g., my_twitter_research_app

Description: Describe use case e.g., for researching trends and behaviors on twitter

Website: Valid website e.g., https://twitter.com/kearneymw

***Callback URL***: http://127.0.0.1:1410

Check yes if you agree and then click “Create your Twitter application”

2a. Authenticate via web browser (interactive)

Go to your app’s page at apps.twitter.com and click the tab labeled Keys and Access Tokens

Copy the Consumer Key and Consumer Secret values and pass them, along with the name of your app, to the create_token() function

And that’s it! You’re ready to start collecting and analyzing Twitter data! And because create_token() automatically saves your token as an environment variable, you’ll be set for future sessions as well!

Package features

Search tweets

Search for up to 18,000 (non-retweeted) tweets containing the rstats hashtag.

Twitter rate limits cap the number of search results returned to 18,000 every 15 minutes. To request more than that, simply set retryonratelimit = TRUE and rtweet will wait for rate limit resets for you.

Contact

Communicating with Twitter’s APIs relies on an internet connection, which can sometimes be inconsistent. With that said, if you encounter an obvious bug for which there is not already an active issue, please create a new issue with all code used (preferably a reproducible example) on Github.