You can also connect to the recent rearch endpoint using one of our code samples:
This will return 10 Tweets objects by default. You can also specify a maximum number of results you want to receive per API call. To do so, you can use the max_results query parameter with your API call. In order to get additional Tweets, you need to handle pagination. To do so, you will need to access the next_token from the object called meta and connect to get the additional Tweet objects back for the next 10 Tweets (by default unless you specify a number with the max_results parameter) until there is no longer a next_token available.
By default, you will get back the id and text of each Tweet. However, you can customize what additional fields you want to return as part of the Tweet payload. You can include these additional fields in the payload by adding additional fields and expansions to your query.
Instead of making curl calls from your terminal, you can use a REST client such as Postman or Insomnia to get data from the recent search endpoint. Our Postman collection will help you get started quickly in calling the recent search endpoint.
Step 3: Analyzing the data for past conversations
The Twitter API provides a good opportunity to study historical data. Examples of analysis that you might be interested in doing with Twitter data include:
Mapping Tweets by location
Sentiment analysis on Tweets about past events
Identifying influencers on Twitter
There are various libraries available in programming languages such as Python, R, etc. that let you analyze the data obtained from Twitter API.
In Python, you can use libraries such as pandas, numpy, etc. that let you do data analysis and wrangling. You can also use libraries such as matplotlib to build visualizations from Twitter data.
In R, you can use something like Tidyverse (which is a collection of R packages for data science) for data analysis. You can use ggplot2, which is part of Tidyverse to build data visualization using Twitter data.
There are a variety of visualizations that you can build using these libraries mentioned above. Some examples of such visualizations that can be built using Twitter data include:
Histograms for displaying Tweet frequency
Map for displaying Tweets by Geo-Location
Time series analysis of Trends
Check out this sample App that demonstrates how to use the recent search endpoint to analyze sentiments of your own Tweets.