PLhery / node-twitter-api-v2

Strongly typed, full-featured, light, versatile yet powerful Twitter API v1.1 and v2 client for Node.js.
https://www.npmjs.com/package/twitter-api-v2
Apache License 2.0
1.25k stars 175 forks source link

Is there any way to retrieve your own tweet organic_metrics and at the same time the referenced_tweets without theirs #432

Open reymon359 opened 1 year ago

reymon359 commented 1 year ago

Hey there 👋

First, thanks for this amazing library, it is helping me develop my app at a great pace and efficiently 😄

I am trying to request my own timeline tweets organic_metrics by adding them on the tweet.fields. By doing so, I retrieve them as expected.

The problem is that if I add the expansions referenced_tweets.id,referenced_tweets.id.author_id to the query I get a Field Authorization Error because (I presume) its attempting to retrieve the organic_metrics from the referenced tweets.

Here is an error example:

  {
    "resource_type": "tweet",
    "field": "organic_metrics.like_count",
    "parameter": "referenced_tweets.id",
    "resource_id": "1602665220689764353",
    "title": "Field Authorization Error",
    "section": "includes",
    "detail": "Sorry, you are not authorized to access 'organic_metrics.like_count' on the Tweet with referenced_tweets.id : [1602665220689764353].",
    "value": "1602665220689764353",
    "type": "https://api.twitter.com/2/problems/not-authorized-for-field"
  },

With this error the referenced_tweets do not come in the response and therefore I am unable to retrieve my own tweets organic_metrics and the referenced_tweets in the same response. I am forced to do x2 queries 🫠

I understand I can not access the organic_metrics on the referenced_tweets and I don't want to, I just need my own organic_metrics.

Is there any way to tell the API that I just want the organic_metrics of my tweets while at the same time retrieve the referenced_tweets without organic_metrics?