Twitter API v2 - what is still possible using rtweet with a free Twitter developer account?

Hi there,

I’m currently wondering what is still possible using rtweet maintained by @llrs in conjuction with a free Twitter developer account since I’m unable to get any Twitter user data?

To perform a social network analysis, I’ve set up free Twitter developer account and created an Twitter app to generate the required keys and tokens to access the Twitter API through rtweet.

I also set up a Twitter client for my app to set up alternative authentication settings as described at Authentication with rtweet • rtweet

Authentication using rtweet_oauth2() seems to work but trying to look up user data using lookup_users() provides the following error. Also app-style authentication using rtweet_app() provides the same error for lookup_users().

Error: Twitter API failed [403]. Check error message at https://developer.twitter.com/en/support/twitter-api/error-troubleshooting 
 * You currently have access to Twitter API v2 endpoints and limited v1.1 endpoints only. If you need access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve (453)

From my understanding a free Twitter developer account should allow some users lookup?!
Thus, I’m not sure if the error is due to the changes on the side of twitter or if I’ve set up things wrong.

Any feedback will be helpful. Many thanks in advance!

I think that currently only using the old authentication mechanism works to retrieve data for free (and only if you get it with elevated access). The free Twitter developer account under the new plan does not allow to lookup data from Twitter (except from your own account and even then extremely limited).

Could you please post the code used? Since you are using rtweet_oauht2 it seems you installed it directly from github. Could you post the version of rtweet you are using?

It is very hard to know which token is in use from your description. It would help if you could also report the output of auth_sitrep().

Hi @llrs,

many thanks for your instant response!

I’m running rtweet_1.2.0.9003 that I installed from github using remotes::install_github("ropensci/rtweet")

The output of auth_sitrep() is:

auth_sitrep() # list of current tokens
Tokens found on C:/Users/strauss/AppData/Roaming/R/config/R/rtweet:
                      token
oauth2_authentication     A
sna-twitter-data          B
Error in names(x) <- value : 
  'names' attribute [3] must be the same length as the vector [2]

Ok, could you please reinstall it from github again (I have worked on it lately and fixed that error you got).

Please do not forget to post the code used (I want to double check which tokens were loaded, which endpoints were used) and the output of auth_sitrep().

Hi @llrs,

I reinstalled from github again using
install.packages("rtweet", repos = 'https://ropensci.r-universe.dev')

I then run the following code block

## load libraries
library(rtweet)

## Authenticate
## Setup authorization protocol
client <- rtweet_client(client_id = "<my_client_id>",
                        client_secret = "<my_client_secret>",
                        app = "sna-twitter-data")
user_oauth2 <- rtweet_oauth2(client = client)
auth_as(user_oauth2)
auth_save(user_oauth2, "oauth2_authentication")

## app-style authentication
auth <- rtweet_app()
auth_save(auth = auth, name = "sna-twitter-data")

Still, the error in the output of auth_sitrep() remains:

Tokens found on C:/Users/strauss/AppData/Roaming/R/config/R/rtweet:
                      token
oauth2_authentication     A
sna-twitter-data          B
Error in names(x) <- value : 
  'names' attribute [3] must be the same length as the vector [2]

P.S.: Also tried re-installing using remotes::github(force = TRUE) as in my previous post before switching to using install.packages() as done above. Yet, it throws the same error when calling auth_sitrep()

Ok, it seems that I didn’t fix correctly the issue with auth_sitrep :frowning: or that I only fixed in the devel branch :thinking: .

Knowing that the authentications are new and you don’t use rtweet_user() you shouldn’t be able to pull data. That’s on Twitter side and nothing I can do within rtweet.

Good luck with your project!

Many thanks for your help @llrs - I really appreciate your time and effort you put into rtweet!

So to put in a nutshell, a free Twitter developer account is more or less useless :thinking:
Unfortunately, of course not what I was hoping for but at least I know now :upside_down_face:

I’m curious if you have you heard of any experience to pull Twitter data using rtweet from people on a paid basic Twitter plan (100$/mo)?

Also, wondering about your current personal view of the future of rtweet after having read your recent posts? How was the response from the community to support rtweet also financially to afford maintenance. I’d be sad to see the package deprecating.

Thanks in advance and all the best!

The basic plan is mostly to post tweet (spam or not :expressionless:).
I have only heard from one user who was using the basic Twitter plan and asked a question.
But I don’t know if others are using it and didn’t have questions/bugs.

There have been no financial support.
I think most R users have decided to abandon Twitter.

I am delaying a bit what to do with rtweet. Probably I will leave it on CRAN until it fails or I think it does more damage than help (I get too much complains and too few support, or people are mislead by post and old guides or similar situations).

@llrs, many thanks for your honest feedback!