Retrieve direct message from API

restapi
directmessages
api

#1

Hi - I am looking to pull direct messages using https://api.twitter.com/1.1/direct_messages.json with a Twitter application. The application is authorized for an account and this account have access to several other accounts. But the direct_messages.json is only retrieving the main account messages. Is there a way to pull the direct messages for all accounts?


#2

Can you explain what this means?

The Teams / Contributors functionality from.Tweetdeck is not available in the API so there is no API support to access direct messages from an account that is not directly authenticated.


#3

Hi Andy,

The twitter account have access to several corporate twitter accounts. We were able to get metrics from these accounts when using the Ads API. But when pulling DMs we are unable to pull the messages. We are only able to pull from the main twitter account we authenticated with. The main twitter account have admin rights to our corporate twitter accounts.


#4

The API is not set up to handle that. Those direct message endpoints only work for the authenticated account and not sub accounts (or accounts that it’s additionally authorized for).


#5

Hi Daniel - thanks for the clarification. If I authorize the app access to all the twitter accounts that I want to pull DMs from, I will be able to pull all the DMs, correct?


#6

Yes. You’ll need to make sure you use the access token for the user that you’re pulling though.