Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

360
Views
Twitter API Javascript: How to count total number of likes and retweets a user has? If impossible due to rate limiting how else to measure engagement?

I'm trying to utilize Twitter API v2 in a javascript file to count how the average number of likes and retweets a user has per tweet. For example, if a user has 3 tweets, one has 5 likes, one has 6 likes, and one has 0 likes, I'd want a function to be able to return the average number of likes (3.67).

I'm finding the total number of tweets utilizing the following endpoint by extracting the status count from the object.

https://api.twitter.com/1.1/users/show.json?screen_name=${username}

How would I go about counting how many total likes a user has across their tweets? How would I go about counting the total number of times a user's tweets have been retweeted?

The closest thing I've found is the user tweet timeline endpoint, however it doesn't return how many likes and retweets each tweet in the timeline has.

https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/api-reference/get-users-id-tweets

I've considered looping through each tweet id in the timeline and calling the following endpoint to get the likes for each tweet, and then sum them. However, there's a rate limit of 50 calls per 15 minutes on this endpoint.

https://api.twitter.com/2/users/:id/likes

Is there any way to get the average number of likes and retweets a user has?

If not, would you have any suggestions of how else I could use the Twitter API to measure how much engagement a Twitter account has? I'm currently tracking number of followers and number of tweets, but I'd like to track engagement in other ways.

Thank you so much!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!