You are here

public function Twitter::direct_messages_new in Twitter 6.5

Same name and namespace in other branches
  1. 7.6 twitter.lib.php \Twitter::direct_messages_new()
  2. 7.5 twitter.lib.php \Twitter::direct_messages_new()

Sends a new direct message to the specified user from the authenticating user.

Parameters

mixed $id: The user ID or the screen name.

string $text: The URL encoded text of the message.

Return value

array of Twitter statuses.

See also

https://dev.twitter.com/docs/api/1.1/post/direct_messages/new

File

./twitter.lib.php, line 634
Integration layer to communicate with the Twitter REST API 1.1. https://dev.twitter.com/docs/api/1.1

Class

Twitter
Primary Twitter API implementation class

Code

public function direct_messages_new($id, $params = array()) {
  if (is_numeric($id)) {
    $params['user_id'] = $id;
  }
  else {
    $params['screen_name'] = $id;
  }
  return $this
    ->call('direct_messages/new', $params, 'POST');
}