Skip to main content
MANIFOLD
Will anyone provide a simple way to fix my code for the new Twitter API restrictions?
3
Ṁ90Ṁ175
resolved Oct 14
Resolved
NO

I had a simple twitter bot that needs to post tweets and replies and upload images. I was using the twit npm library. Using it now returns the error:

You currently have access to a subset of Twitter API v2 endpoints and limited v1.1 endpoints (e.g. media post, oauth) only. If you n

eed access to this endpoint, you may need a different access level. You can learn more here: https://developer.twitter.com/en/portal/product

The free plan does allow me to post tweets, so it should be possible in theory to switch over without paying Twitter anything. I think this package is just outdated.

I tried using twitter-v2 instead, as it seemed to have very similar syntax, but that returns the error:

FetchError: invalid json response body at https://api.twitter.com/2/account/verify_credentials?include_entities=false&skip_status=true&include_email=false reason: Unexpected end of JSON input

It looks like the most up-to-date package is twitter-api-v2, but it has completely different syntax, and I don't want to rewrite the whole project. I'm hoping there's some project that uses the same syntax as twit, where I can just tweak one setting to have it use the new v2 endpoints that work with the free API plan rather than the v1.1 endpoints that don't.

Market context
Get
Ṁ1,000
to start trading!

🏅 Top traders

#TraderTotal profit
1Ṁ27
2Ṁ16
3Ṁ0
Sort by:
predictedNO

As Brendan Eich once said "always bet on JavaScript" 😅