I just discovered an undocumented oddity with tweets embedded in direct messages. When reading DMs with the API, and the text of the DM is 140 characters or fewer, any embedded tweets in the DM show the usual Twitter status URL; for example:
https://twitter.com/[USERNAME]/status/[TWEET_ID]
But if the text of the DM is more than 140 characters, the URL for the tweet is in a format I haven’t seen before:
https://twitter.com/messages/[USER_ID]-[USER_ID]
The two numbers in this URL are the sender’s and recipient’s user ID, and entering this URL into a browser brings up either a login screen or the direct messages popup dialog.
The app I’m working on needs to get tweet URLs from these DMs, but if the text is longer than 140 characters, there appears to be no way to get that URL from the API. Is there a way to get the actual tweet URL from such a DM, or am I out of luck?