7

I am trying hard to find a way to reply to a tweet with Twitter API V2, but it seems there is no endpoint for doing something like that, in Twitter Developer docs i found a way to post and delete a tweet, to retweet a tweet and delete a retweet, but i am struggling with replies, can you please help me with this? Thanks.

VLAZ
  • 26,331
  • 9
  • 49
  • 67
Edin Osmic
  • 374
  • 5
  • 25
  • I find out how to do this. Endpoint for this action is "https://api.twitter.com/2/tweets", and parameters you have to pass are "text" and "reply" object with "in_reply_to_tweet_id" key, like this "reply: { in_reply_to_tweet_id: tweet_id } – Edin Osmic May 23 '22 at 10:33
  • 1
    If you found a solution, please post your comment as an answer. – jnv Jun 03 '22 at 15:34

1 Answers1

9

For anyone coming later at this post, here is answer: Endpoint for this action is "api.twitter.com/2/tweets", and parameters you have to pass are "text" and "reply" object with "in_reply_to_tweet_id" key, like this "reply: { in_reply_to_tweet_id: tweet_id }

Edin Osmic
  • 374
  • 5
  • 25
  • 1
    What is the encoded URI equivalent of this? Ex: api.twitter.com/2/tweets?query=&reply=in_reply_to_tweet_id=tweet_id,text=text I know this isn't right but I can't figure out the format. – Lwood Apr 28 '23 at 15:50
  • 1
    @edin-osmic , can you please post the complete working solution? We are getting 403 (unsupported authentication) with bearer token. Though same token works for all other API calls. – understack May 16 '23 at 08:03
  • How can I get the id of the variable response since response.id does not work? [AttributeError: 'Response' object has no attribute 'id'] response = client.create_tweet(text=tweet_msg) client.create_tweet(text=reply_msg, in_reply_to_tweet_id=response.id) – Raul Jul 26 '23 at 06:42