getDirectMessages method is not returning the values



Im trying to retrieve direct messages using the REST API method getDirectMessages, but im getting empty response. When i call the josn in postman “/1.1/direct_messages/events/list.json” it works but using the proxy file it doesn’t work. Can someone please help me.

<?xml version="1.0" encoding="UTF-8"?>



var payload = mc.getPayloadJSON();
var Messages = payload;
var response = new Array();

		for (i = 0; i &lt; Messages.length; ++i) {
			Message = Messages[i];
			messageObject = new Object();
			messageObject.date_time = Message.created_at;
			messageObject.channel_message = Message.text.replace(/[^a-zA-Z 0-9]/g, "");
			messageObject.channel_message_ID = Message.id_str;
			messageObject.channel_thread_id = Message.sender.id_str;
			messageObject.channel_ID = Message.sender.id_str;
			messageObject.created_by = Message.sender.screen_name;
			response[i] = messageObject;
    <property name="messageType" scope="axis2" value="application/json"/>
				<http method="POST" uri-template="http://localhost:3000/api/message"/>


What programming environment is this? This does not look like code supplied by Twitter.


Hi Andy,

We are using WSO2 ESB(Enterprise Service Bus) in order to manipulate the response as per business requirements. It uses twitter connector zip file which actually contains the twitter API methods. In <twitter.init> section we pass the required access tokens and the <twitter.getDirectMessages> actually calls the API method. The javascript to manipulate the output.



Now i see, the below error though i was using id_str instead of id.

{“errors”:[{“code”:34,“message”:“Sorry, that page does not exist.”}]}

Did anything changed as part of Direct messages API ?


Looks like that connector was patched for the new API format a couple of months ago


Yes, you are right ! We were using the older version of connector and few methods are now deprecated. We no need to call getSentDirectMessages and just getDirectMessages would be sufficient to receive all the direct messages both sent and received. After removing the unnecessary call backs it’s working again now. Thank you so much for the information provided.

Best Regards,


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.