How to automate a request to get all tweets of an hashtag

I want to get the daily bucket count for tweets carrying the #ENDSARS hashtag, and also retrieve all tweets carrying the #ENDSARS hashtag between December 2017 and October 2020. My request can only get 500 tweets (which is the Twitter API benchmark). I use the Academic Research product track of the Twitter API, so i have access to collecting 10million tweets a month.
How can i collect this large volume of tweets using postman?

1 Like

Hi @osemele! Welcome to the Postman community! :trophy:

Funny you should ask this question, as I did something quite similar very recently! I created a collection to search for a specific hashtag for our virtual conference, Postman Galaxy. You can check out and fork the collection here!

The basic gist of the collection is that it searches for a hashtag in the query field like this: %23ENDSARS. It was designed to run on a monitor every 5 minutes to pull in the most recent batch of tweets with the hashtag I was searching for. It tracks the id of the most recent tweet each time it runs, and on each ensuing run, it only searches for tweets that have an id that is newer than the id that was tracked. This ensures you’re only getting the freshest tweets every 5 minutes.

To go back and capture the older tweets, this can be done by taking advantage of the postman.setNextRequest method and calling the same “Search for Tweets” request multiple times. This must be done by also capturing and using the next_token returned by the Twitter API. You could create an array as an environment variable and every time the “Search for tweets” request is run, it adds the new found tweets to the array and continues to do so each time the collection is run. I actually talk a bit about something similar in this post here!

I would recommend forking the collection I linked to in the beginning of this post and see if that helps you get started. The collection will help you stay up to date with new and current tweets, the older forum post I wrote should help you go back and programmatically get all of the historical tweets. If you run into issues or have further questions, feel free to post here again :slight_smile:

2 Likes

Sean. I cannot express how much I feel grateful to this feedback.
I will surely try the links out. My target is to get tweets carrying the hashtag between December 2017 and October 2020. So its a long stream of data.
I hope the links would help.
Thank you so much. I am extremely grateful.

1 Like

Again Sean, the links you sent are best suited for recent search. What would capture my work will definitely be the Full Archive Search. I have access to the Academic Research Product Track of the Twitter API so, I can collect as many millions of tweets the hashtag request might send in as response.

Thanks alot Sean for your feedbacks on my questions on the support community. However, the links you sent are best suited for Recent Search.

I was thinking if you could do this for me. Can you please spare me 30 mins of your time (out of your busy schedule) so we can have a video chat. this would help me get a step by step instruction on how to go by this. I have a Political Science background, so I am new on Postman, Twitter API and Programming in general. However, I have read widely and seen many resources with little success.

So sorry to bother you this much. I would appreciate if you can take time out to assist me through this.

Thanks once again, Sean.

1 Like

Hi @osemele ,

Ideally we keep any sort of help here on the public forum, so others can benefit from the solution as well!

Were you able to make any progress on getting this to work? If you can provide some screen shots or example code of where you got stuck in trying, myself and others are happy to help chip in :slight_smile:

I know this post has a LOT of info, but should be very helpful in getting old tweets.

2 Likes