The Direct Messages endpoint won't return more than five messages

directmessages
api

#1

No matter what value I specify for the “count” parameter, the Direct Messages endpoint won’t return more than five messages. Here’s my cURL test call…

curl --get 'https://api.twitter.com/1.1/direct_messages.json' --data 'count=10' --header 'Authorization: OAuth oauth_consumer_key="my_consumer_key", oauth_nonce="f2a85c1a9937c918141f2bb7c14df341", oauth_signature="RkGIgY%2FokalTtDYAMxbbmlUdLvI%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1438117223", oauth_token="my_oauth_token", oauth_version="1.0"' --verbose

Thanks in advance for your help!


#2

Does the account authenticating have more than 10 DMs? Have tried a much larger number like 100? If you’ve deleted a number of DMs recently those contribute to the count but are not returned.


#3

The account I’m using for testing has roughly 30 DMs and I’ve tried testing with larger numbers, like 100, 200, etc. Your thoughts?


#4

This seems odd, and I can’t see an immediate reason for it. How old are the DMs?

I’m testing with an account like this:

twurl "/1.1/direct_messages.json?count=40" | jq '.[] | .text, .created_at'

This consistently is returning 40 DMs. However, the account receives DMs regularly, so these are all within the last 5 days.


#5

Isn’t there some time frame that DMs older than that stop getting returned from the API?


#6

It’s possible, but if so that information isn’t currently in the docs for the endpoint, and it is not in my head, either! That’s why I thought I’d ask if @joecrotchett was seeing something that could be attributed to age of the DMs.


#7

It could be attributed to the age of the DMs. The five DMs that I was getting back date back August 2014, so I just added six new DMs to my account and now I’m getting back eleven DMs total. I’m still not getting back any of the DMs before August 2014, but I don’t think that’s a big deal. I’m going to move forward with the assumption there’s a time frame on DMs. Thanks for all your help, fellas!