POST direct_messages/new

Updated on Tue, 2012-10-02 14:07

Sends a new direct message to the specified user from the authenticating user. Requires both the user and text parameters and must be a POST. Returns the sent message in the requested format if successful.

Resource URL

https://api.twitter.com/1.1/direct_messages/new.json

Parameters

One of user_id or screen_name are required.

user_id optional

The ID of the user who should receive the direct message. Helpful for disambiguating when a valid user ID is also a valid screen name.

Example Values: 12345

screen_name optional

The screen name of the user who should receive the direct message. Helpful for disambiguating when a valid screen name is also a user ID.

Example Values: noradio

text required

The text of your direct message. Be sure to URL encode as necessary, and keep the message under 140 characters.

Example Values: Meet me behind the cafeteria after school

Example Request

POST

https://api.twitter.com/1.1/direct_messages/new.json

POST Data

text=hello%2C%20tworld.%20welcome%20to%201.1.&screen_name=theseancook


  1. {
  2.     "created_at": "Tue Aug 28 00:59:49 +0000 2012", 
  3.     "entities": {
  4.         "hashtags": [], 
  5.         "urls": [], 
  6.         "user_mentions": []
  7.     }, 
  8.     "id": 240252311455277056, 
  9.     "id_str": "240252311455277056", 
  10.     "recipient": {
  11.         "contributors_enabled": true, 
  12.         "created_at": "Sat May 09 17:58:22 +0000 2009", 
  13.         "default_profile": false, 
  14.         "default_profile_image": false, 
  15.         "description": "I taught your phone that thing you like.  The Mobile Partner Engineer @Twitter. ", 
  16.         "favourites_count": 584, 
  17.         "follow_request_sent": false, 
  18.         "followers_count": 10622, 
  19.         "following": true, 
  20.         "friends_count": 1181, 
  21.         "geo_enabled": true, 
  22.         "id": 38895958, 
  23.         "id_str": "38895958", 
  24.         "is_translator": false, 
  25.         "lang": "en", 
  26.         "listed_count": 190, 
  27.         "location": "San Francisco", 
  28.         "name": "Sean Cook", 
  29.         "notifications": false, 
  30.         "profile_background_color": "1A1B1F", 
  31.         "profile_background_image_url": "http://a0.twimg.com/profile_background_images/495742332/purty_wood.png", 
  32.         "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/495742332/purty_wood.png", 
  33.         "profile_background_tile": true, 
  34.         "profile_image_url": "http://a0.twimg.com/profile_images/1751506047/dead_sexy_normal.JPG", 
  35.         "profile_image_url_https": "https://si0.twimg.com/profile_images/1751506047/dead_sexy_normal.JPG", 
  36.         "profile_link_color": "2FC2EF", 
  37.         "profile_sidebar_border_color": "181A1E", 
  38.         "profile_sidebar_fill_color": "252429", 
  39.         "profile_text_color": "666666", 
  40.         "profile_use_background_image": true, 
  41.         "protected": false, 
  42.         "screen_name": "theSeanCook", 
  43.         "show_all_inline_media": true, 
  44.         "statuses_count": 2608, 
  45.         "time_zone": "Pacific Time (US & Canada)", 
  46.         "url": null, 
  47.         "utc_offset": -28800, 
  48.         "verified": false
  49.     }, 
  50.     "recipient_id": 38895958, 
  51.     "recipient_screen_name": "theSeanCook", 
  52.     "sender": {
  53.         "contributors_enabled": false, 
  54.         "created_at": "Thu Aug 23 19:45:07 +0000 2012", 
  55.         "default_profile": false, 
  56.         "default_profile_image": false, 
  57.         "description": "Keep calm and test", 
  58.         "favourites_count": 0, 
  59.         "follow_request_sent": false, 
  60.         "followers_count": 0, 
  61.         "following": false, 
  62.         "friends_count": 11, 
  63.         "geo_enabled": true, 
  64.         "id": 776627022, 
  65.         "id_str": "776627022", 
  66.         "is_translator": false, 
  67.         "lang": "en", 
  68.         "listed_count": 0, 
  69.         "location": "San Francisco, CA", 
  70.         "name": "Mick Jagger", 
  71.         "notifications": false, 
  72.         "profile_background_color": "000000", 
  73.         "profile_background_image_url": "http://a0.twimg.com/profile_background_images/644522235/cdjlccey99gy36j3em67.jpeg", 
  74.         "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/644522235/cdjlccey99gy36j3em67.jpeg", 
  75.         "profile_background_tile": true, 
  76.         "profile_image_url": "http://a0.twimg.com/profile_images/2550256790/hv5rtkvistn50nvcuydl_normal.jpeg", 
  77.         "profile_image_url_https": "https://si0.twimg.com/profile_images/2550256790/hv5rtkvistn50nvcuydl_normal.jpeg", 
  78.         "profile_link_color": "000000", 
  79.         "profile_sidebar_border_color": "000000", 
  80.         "profile_sidebar_fill_color": "000000", 
  81.         "profile_text_color": "000000", 
  82.         "profile_use_background_image": false, 
  83.         "protected": false, 
  84.         "screen_name": "s0c1alm3dia", 
  85.         "show_all_inline_media": false, 
  86.         "statuses_count": 0, 
  87.         "time_zone": "Pacific Time (US & Canada)", 
  88.         "url": "http://cnn.com", 
  89.         "utc_offset": -28800, 
  90.         "verified": false
  91.     }, 
  92.     "sender_id": 776627022, 
  93.     "sender_screen_name": "s0c1alm3dia", 
  94.     "text": "hello, tworld. welcome to 1.1."
  95. }