GET direct_messages

Updated on Fri, 2012-07-06 15:57

Returns the 20 most recent direct messages sent to the authenticating user. The XML and JSON versions include detailed information about the sender and recipient user. You can request up to 200 direct messages per call, up to a maximum of 800 incoming DMs.

Important: This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.

Resource URL

https://api.twitter.com/1/direct_messages.format

Parameters

since_id optional

Returns results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available.

Example Values: 12345

max_id optional

Returns results with an ID less than (that is, older than) or equal to the specified ID.

Example Values: 54321

count optional

Specifies the number of direct messages to try and retrieve, up to a maximum of 200. The value of count is best thought of as a limit to the number of Tweets to return because suspended or deleted content is removed after the count has been applied.

Example Values: 5

page optional

Specifies the page of results to retrieve.

Example Values: 3

include_entities optional

When set to either true, t or 1, each tweet will include a node called "entities,". This node offers a variety of metadata about the tweet in a discreet structure, including: user_mentions, urls, and hashtags. While entities are opt-in on timelines at present, they will be made a default component of output in the future. See Tweet Entities for more detail on entities.

Example Values: true

skip_status optional

When set to either true, t or 1 statuses will not be included in the returned user objects.

Example Request

GET

https://api.twitter.com/1/direct_messages.json?count=1&page=1

  1. [
  2.   {
  3.     "created_at": "Tue Jun 22 17:48:26 +0000 2010",
  4.     "sender_screen_name": "themattharris",
  5.     "sender": {
  6.       "name": "Matt Harris",
  7.       "profile_sidebar_border_color": "C0DEED",
  8.       "profile_background_tile": false,
  9.       "profile_sidebar_fill_color": "DDEEF6",
  10.       "location": "San Francisco",
  11.       "profile_image_url": "http://a1.twimg.com/profile_images/554181350/matt_normal.jpg",
  12.       "created_at": "Sat Feb 17 20:49:54 +0000 2007",
  13.       "profile_link_color": "0084B4",
  14.       "favourites_count": 95,
  15.       "url": "http://themattharris.com",
  16.       "contributors_enabled": false,
  17.       "utc_offset": -28800,
  18.       "id": 777925,
  19.       "profile_use_background_image": true,
  20.       "profile_text_color": "333333",
  21.       "protected": false,
  22.       "followers_count": 1026,
  23.       "lang": "en",
  24.       "verified": false,
  25.       "profile_background_color": "C0DEED",
  26.       "geo_enabled": true,
  27.       "notifications": false,
  28.       "description": "Developer Advocate at Twitter. Also a hacker and British expat who is married to @cindyli and lives in San Francisco.",
  29.       "time_zone": "Tijuana",
  30.       "friends_count": 294,
  31.       "statuses_count": 2923,
  32.       "profile_background_image_url": "http://s.twimg.com/a/1276711174/images/themes/theme1/bg.png",
  33.       "screen_name": "themattharris",
  34.       "following": true
  35.     },
  36.     "text": "sure thing. Meet you at the mall around 7?",
  37.     "recipient_screen_name": "mattytest",
  38.     "id": 1270520569,
  39.     "recipient": {
  40.       "name": "mattytest",
  41.       "profile_sidebar_border_color": "C0DEED",
  42.       "profile_background_tile": false,
  43.       "profile_sidebar_fill_color": "DDEEF6",
  44.       "location": "",
  45.       "profile_image_url": "http://a1.twimg.com/profile_images/644612310/matt_bright_normal.png",
  46.       "created_at": "Thu Jan 22 16:27:50 +0000 2009",
  47.       "profile_link_color": "0084B4",
  48.       "favourites_count": 0,
  49.       "url": null,
  50.       "contributors_enabled": false,
  51.       "utc_offset": -28800,
  52.       "id": 19345946,
  53.       "profile_use_background_image": false,
  54.       "profile_text_color": "333333",
  55.       "protected": true,
  56.       "followers_count": 3,
  57.       "lang": "en",
  58.       "verified": false,
  59.       "profile_background_color": "C0DEED",
  60.       "geo_enabled": true,
  61.       "notifications": false,
  62.       "description": "",
  63.       "time_zone": "Tijuana",
  64.       "friends_count": 2,
  65.       "statuses_count": 9,
  66.       "profile_background_image_url": "http://s.twimg.com/a/1277162817/images/themes/theme1/bg.png",
  67.       "screen_name": "mattytest",
  68.       "following": false
  69.     },
  70.     "recipient_id": 19345946,
  71.     "sender_id": 777925
  72.   }
  73. ]