TwythonError: Twitter API returned a 403 (Forbidden), This application is not allowed to access or delete your direct messages

ads

#1

import json
APP_KEY = ''
APP_SECRET = '
'
OAUTH_TOKEN = ''
OAUTH_TOKEN_SECRET = '
'
twitter = Twython(APP_KEY, APP_SECRET,OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
twitter.request(‘https://api.twitter.com/1.1/direct_messages.json’)

Error:
TwythonError: Twitter API returned a 403 (Forbidden), This application is not allowed to access or delete your direct messages.


#2

Does the app show as having access to Direct Message permissions on the apps.twitter.com dashboard? When you authenticated to obtain the token and secret, did you get shown that the app was requesting that permission? (or did you generate the tokens from apps.twitter.com - if so, did you regenerate them after setting the permissions?)


#3

Currently the app does not have access to Direct message.
after changing the permission to direct message can i use the same app or should i create new app?


#4

You should turn it on. :slight_smile:

Yes, you can use your same app. You don’t need to create a new app.

Hope it helps. I will look forward to your reply.
God Bless.


#5

Thank u


#6

No problem. I hope your problem is solved.


#7

one more question.
api request to get linkclicks and page impression for particular page(twitter ads)?


#8

You can use Engagement API which is a paid product.

But I think, Analytics is best option for non-commercial work. You can easily view your tweet activity. Here’s an example of a video tweet,


Hope it helps. I’ll look forward to your reply.
God Bless.


#9

is there a way to scrape the data in twitter ads?


#10

Scraping the Twitter site is against the terms of service.


#11

I hope you’ve got your answer @ajayanilkumar1.
God Bless.