0

I'm using twitter-api-v2 to get tweet replies by id, and it working, but the query isn't.

This is my code:

 const data = await client.v2.search("123456789", {
    "query": "from:username to:'username'",
    "expansions": ["author_id"]
  });

  console.log(data.tweets);

(username is the actual username of a twitter profile)

I got the query from the Twitter Query Builder

I'm getting the default limit of 10 tweets, but some of the are from users that are not the author, so I'm wondering if I'm missing something?

Sam Chahine
  • 530
  • 1
  • 17
  • 52

1 Answers1

0

but some of the are from users that are not the author

this is because of to:'username', this refers to the tweets that are in reply to a tweet of the user defined by username.

enter image description here

try removing the to query.

Can Bilgin
  • 471
  • 2
  • 6