sferik / x-ruby

A Ruby interface to the X API.
MIT License
68 stars 13 forks source link

Add retweet support #27

Closed kyrylo closed 1 month ago

kyrylo commented 2 months ago

https://developer.twitter.com/en/docs/twitter-api/tweets/retweets/quick-start/retweets-lookup

P.S. Apologies if this is already implemented (I did a quick search and couldn't find anything).

sferik commented 2 months ago

Retweets should be supported. Have you tried posting one? If so, what error are you getting?

kyrylo commented 2 months ago

Do you mind pointing me to the right file/example?

I am not familiar with how X/Twitter retweets work.

kyrylo commented 1 month ago

This is how you're supposed to do it, apparently:

x_client = X::Client.new(**credentials)
x_client.post("users/YOUR_ID/retweets", '{"tweet_id": 1780748584775823851}')

If you're on the Free plan, you will see the following error:

Client Forbidden: When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal. (X::Forbidden)

Retweets are supported starting with Basic.