Missing incoming direct message from twitter streaming API


Here is our current situation, in our application we are using twitter streaming API to get mention and direct messages from userstream. However, we encountered rare cases where some DM was not pushed to the stream API so our application is missing out interactions.

Current investigation indicate that one missing DM comes from a protected user account. Does it have any effect on DM delivery on the stream? Or are there any other possible causes for this to happen?


Just to understand more - you’re saying that…

  • you’re authenticated to the userstream as user A
  • user A follows (protected) user B; user B has approved the friend request, and user A can see user B’s timeline on the web
  • (protected) user B sends a direct message to user A, but it doesn’t show up in the stream

Is that right?

Can user A retrieve the same direct message from (protected) user B via the REST API?


Hi Andy thanks for your reply,

Just to clarify, we do not actually follow (protected) user B. But you’re right about point number 1 and 3.



So if you are not following them how can they DM you? Can you see their timeline on the web?


I have tested that even without following the (protected) person we can still get their direct message through the stream API. No I can’t see their timeline.



For additional information, we have actually enabled “Receive direct messages from anyone” on user privacy and safety setting


So now I’m confused, you’re saying here you can receive messages from the protected user via userstreams, but previously you were saying you could not. Apologies for any misunderstanding on my side!


Hi andy, sorry for the confusion. Basically, there is a DM that wasn’t pushed by the streaming API to our application, and I thought that it is because of the protected user. That is why I’m asking in the forum, does the protected user has any affect on DM delivery stream. Because, the missing DM comes from protected user account. However, I tried to test this scenario with protected user messages to the authenticated user, and even without following the protected user we can still get their message through the stream API. But I’m still not sure whether the protected account has any affects to DM delivery stream.

It causes an issue to our application because when there are many incoming messages coming through the stream API, there is always one or two message that is not pushed to the stream API.

Hope that is clear


As I understand it there should be no impact from the account being protected. Are there a high volume of DMs coming through the stream? My hypothesis is that messages may be dropped if the stream is too busy to serve them. That’s just a guess.


Yes, there are a high volume of DMs coming through the stream. Do you know whether twitter stream API just randomly drop some messages? Or is there any characteristics for what messages are being dropped?