Twitter Search Examples for Twitter Bots

This is a complete list of search operators that you can use with Twitter Bots. The bots will use the Twitter API to find tweets that match your search criteria and perform the action on each of the matching tweets.

Twitter Search Operators

Search QueryDescription
red applesTweets that contain both “red” and “apples” anywhere. This is the default operator
“merry chrismtas”Tweets that contain the exact phrase in the same order
Apples OR OrangesUse the Boolean OR operator in capital letters
#foodAll tweets that contain a particular hashtag
@labnolTweets that @mention or reference a particular user
grapes -apples -orangesTweets that contain grapes but not the words apple or oranges
from:BarackObamaTweets written by a specific Twitter user
from:BarackObama to:WhitehouseTwitter from one user that mention another specific user
to:BarackObama -filter:links -filter:imagesTweets that do not contain links or images
elections list:TIME/time-staffSearch for tweets from users who belong to a particular Twitter list
#foodrecipe lang:enTweets sent in particular language (en = English). Do not use the lang operator to search tweets in any language.
#holiday good OR amazing OR awesome filter:imagesTweets that mention #holiday, described as awesome or amazing, and include photographs
tornado filter:mediaShow tornado tweets containing images or videos
music concert filter:native_videoShow tweets that contain native video (uploaded inside tweet)
india filter:newsShows tweets containing news stores
iphone url:amazonShow tweets that contain the word “iphone” a URL with the word amazon anywhere in the web address.
awesome video filter:linksShow tweets that contain the words “awesome” and “video” and include a link (URL)
include:repliesThe Twitter bot, by default, will ignore tweets that are replies to another tweets
include:retweetsThe Twitter bot, by default, will skip tweets that are retweets. We suggest that you do not include this filter.

How to Search Tweets by location

You can use Twitter bots to only search for geotagged tweets but it takes a few extra steps to construct your search query using geolocation.

Go to Google Maps Lookup and search for a location (let’s say Battery Park, NY).


The info window will display the latitude and longitude information of that place. In the Twitter bot search box, enter geocode:latitude,longitude,radius, where radius units must be specified as either mi (miles) or km (kilometers).

For this example, our geolocation query would be:

geocode:40.7024946,-74.016858,2mi (Search tweets by users located within 2 mile radius of the Battery Park area)

How to Search Tweets by popularity

Thousands of tweets are posted every minute and a good number of them could be spam. Twitter offers no option to filter tweets by quality but, while setting up Twitter Bots, you can set up a threshold and any tweet not matching that number will be ignored.

You can specify the Follower / Friend count and tweets from users who have less number of followers / friend that the specified number are ignored.

Similarly, you can specify a minimum number of favorites / retweet count and the bot would only look at tweets that have been retweeted or favorited at least that many number of times.


Twitter Search Limitations

While the Twitter search API is powerful, there are few limitations that you should be aware of.

  1. Limit your searches to 10 keywords and operators.
  2. The near: search operator does not work with Twitter bots. Use the geocode: operator as described above.
  3. You cannot use before or after search operators to search old tweets by date. These date search operators only work on the Twitter website.
  4. Twitter search results have a 7 day limit and no tweets will be found for a date older than one week.
  5. Twitter API may not handle queries that are either too long or contain too many search operators.
  6. The Twitter Search API is not meant to be an exhaustive source of Tweets. Not all Tweets will be indexed or made available via the search interface.
  7. You can use the lang operator to restrict tweets to the given language but language detection may not be perfect.
  8. When conducting geo searches, the search API will first attempt to find Tweets which have lat/long within the queried geocode, and in case of not having success, it will attempt to find Tweets created by users whose profile location can be reverse geocoded into a lat/long within the queried geocode, meaning that is possible to receive Tweets which do not include lat/long information.
Amit Agarwal

Amit Agarwal

Google Developer Expert, Google Cloud Champion

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.

Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory


Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.