Twitter Direct Message

Direct Messages are short, non-public messages sent between two users. Access to Direct Messages is governed by the The Application Permission Model.

Figure 1a. Instantiate Direct Message
$message = eden('twitter')->directMessage('[TWITTER_KEY]', '[TWITTER_SECRET]', $_SESSION['access_token'], $_SESSION['access_secret']);
Figure 1b. Usage: Get Message Details
$detail = $message->getDetail($id);
Figure 1c. Usage: Get Message List
$messages = $message
	->includeEntities()	//optional
	->skipStatus(true)	//optional
	->setSince(12345)	//optional
	->setMax(0)			//optional
	->setCount(0)		//optional
	->setPage(1)		//optional
	->getList();
Figure 1d. Usage: Get Sent Messages
$sent = $message
	->includeEntities()	//optional
	->setSince(12345)	//optional
	->setMax(0)			//optional
	->setCount(0)		//optional
	->setPage(1)		//optional
	->getSent();
Figure 1e. Usage: Send a message to a Use
$message->send('openovate', 'YOUR MESSAGE GOES HERE');
Figure 1f. Usage: Remove Message
$message->remove('MESSAGE_ID');
Figure 1g. Direct Message Methods
Method Arguments Returns Description
$message->getList(); none array Returns the 20 most recent direct messages sent to the authenticating user.
$message->getSent(); none array Returns the 20 most recent direct messages sent by the authenticating user.
$message->getDetail($messageId);
  1. int
  2. - message ID
array Returns a single direct message, specified by an id parameter.
$message->remove($id);
  1. int
  2. - message ID
array Destroys the direct message specified in the required ID parameter. The authenticating user must be the recipient of the specified direct message.
$message->send($id, $text);
  1. string|int
  2. - user ID or screen name
  3. string
array Sends a new direct message to the specified user from the authenticating user.
$message->includeEntities(); none Eden_Twitter_Directmessage 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.
$message->setCount($count);
  1. integer
Eden_Twitter_Directmessage 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.
$message->setMaxId($maxId);
  1. integer
Eden_Twitter_Directmessage Returns results with an ID less than (that is, older than) or equal to the specified ID.
$message->setPage($page);
  1. integer
Eden_Twitter_Directmessage Specifies the page of results to retrieve.
$message->setSinceId($sinceId);
  1. integer
Eden_Twitter_Directmessage 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.
$message->setWrap($wrap);
  1. boolean
Eden_Twitter_Directmessage Set wrap link
$message->skipStatus(); none Eden_Twitter_Directmessage Statuses will not be included in the returned user objects.

© 2012 Openovate Labs. All rights reserved.