Accessing direct messages for specific twitter handle and hashtag

I would like to access my direct messages and retrieve messages that are from a specific twitter handle AND contains a specific hashtag. Also, I would like to use this combination multiple times, an example is:

Retrieve tweets in my direct messages that match:
@userA with hashtag #examplehashtag and
@userB with hashtag #examplehashtag and
@userC with hashtag #examplehashtag and
@userD with hashtag #examplehashtag
Etc etc up to about 50 users

Things to note:

  • If a specific direct message is not available or does not exist I don’t want it to throw back an error (eg, if @userC didn’t send a direct message then I still want it to get A, B and D)

Please let me know if this is possible and what the limitation on how many I could retrieve in one query are. Also, which API I would use.


Our Direct Message API is very simple. To do what you would like to do, you would need to retrieve the entire set of direct messages in a user’s inbox, then filter the data from your application.