This project has moved. For the latest updates, please go here.

Querying Direct Messages Sent to a User

Gets the 20 latest Direct Messages sent to a user.

Entity: DirectMessage
Type: DirectMessageType.SentTo
Parameters/Filters:
Name Purpose Type Required
Count Number of direct messages to return; max is 200 int no
IncludeEntities Include Twitter entities bool no
MaxID Return direct messages earlier than or equal to this ID ulong no
Page Page to retrieve int no
SinceID Return direct messages later than this ID ulong no
SkipStatus Exclude status information bool no

v3.0 Example:
            var dmResponse =
                await
                    (from dm in twitterCtx.DirectMessage
                     where dm.Type == DirectMessageType.SentTo
                     select dm)
                    .ToListAsync();

            if (dmResponse != null)
                dmResponse.ForEach(dm => 
                {
                    if (dm != null && dm.Recipient != null)
                        Console.WriteLine(
                            "Name: {0}, Tweet: {1}",
                            dm.Recipient.ScreenNameResponse, dm.Text);
                });
v2.1 Example:
            var directMessages =
                (from tweet in twitterCtx.DirectMessage
                 where tweet.Type == DirectMessageType.SentTo &&
                       tweet.Count == 2
                 select tweet)
                 .ToList();

            directMessages.ForEach(
                dm => Console.WriteLine(
                    "Sender: {0}, Tweet: {1}",
                    dm.SenderScreenName,
                    dm.Text));

Twitter API: direct_messages

Last edited Nov 29, 2013 at 2:23 AM by JoeMayo, version 11