Why does Twitter API count param not working as expected?

Viewed 59

I'm trying to fetch the list of recent direct messages of a user. However, the number of messages I receive is very random.

For example:

const messages = await request.get({
  url: `https://api.twitter.com/1.1/direct_messages/events/list.json?count=50`,
  oauth: twitterOauth
})
const messages = await request.get({
  url: `https://api.twitter.com/1.1/direct_messages/events/list.json?count=15`,
  oauth: twitterOauth
})
const messages = await request.get({
  url: `https://api.twitter.com/1.1/direct_messages/events/list.json`,
  oauth: twitterOauth
})

They all give me back 11 messages. When using the cursor from that request, I receive 10 extra messages.

On the other hand:

const messages = await request.get({
  url: `https://api.twitter.com/1.1/direct_messages/events/list.json?count=5`,
  oauth: twitterOauth
})

This request gives me 4 messages.

This is super inefficient, and the rate limit doesn't help. Anybody knows how I can fetch 50 messages in 1 request, or is it simply not possible?

Thank you.

0 Answers
Related