I’m having an issue while sending DMs over the REST 1.1 API. Though the DM will send and the recipient gets it correctly, the response i get from the API is not as expected. I’m recieving the JSON of my most recent public tweet back rather than the DM i just sent. I’m using the PHP TwitterAPIExchange plugin and my code is below. Has anyone else experienced this?
function sendDMTweet($settings,$tweetText,$twitterHandle)
{
$url = 'https://api.twitter.com/1.1/statuses/update.json';
$postfields = array(
'status' => 'D '.$twitterHandle.' '.$tweetText,
);
$requestMethod = 'POST';
$twitter = new TwitterAPIExchange($settings);
$resultsFromTwitterAPI = $twitter->setPostfields($postfields)
->buildOauth($url, $requestMethod)
->performRequest();
return $resultsFromTwitterAPI;
}