2022-06-25

Twitter DM API not returning all messages

I’m calling the 1.1 direct messages events list endpoint as an authenticated user, I’ve send a few messages to the accompanying account from two different other twitter accounts. However I’m only getting the message_create results for the messages from one of the senders. Not both.

When I’m signed in in the browser on Twitter, I do see the DM’s from both accounts.

Since the number of direct messages this account has is < 20, I also do not get a next_cursor property. So there is no "next page" which contains the messages.

All messages have been send within the last week, so it’s not that the 30 day limit is in play here.

The (shortened) response I get back:

{
    "events": [{
        "type": "message_create",
        "id": "1537138057991884809",
        "created_timestamp": "1655317246326",
        "message_create": {
            "target": {
                "recipient_id": "114729189"
            },
            "sender_id": "1520424127873654786",
            "source_app_id": "3033300",
            "message_data": {
                "text": "An image",
                "entities": {
                    "hashtags": [],
                    "symbols": [],
                    "user_mentions": [],
                    "urls": []
                }
            }
        }
    }, 
    
    // There are more events, but all with the same sender_id.
    // But i have two different people who send a direct message (not a group message) to me.
    ],
    "apps": {
        "3033300": {
            "id": "3033300",
            "name": "Twitter Web App",
        }
    }
}

enter image description here

See the above screenshot, where you can see I can read both dm’s in Twitter itself.

Am I missing something, or is there some limitation on this endpoint I do not know about? There don't really seem to be any arguments I can pass according to the documentation.



No comments:

Post a Comment