Reputation: 1
I am trying to make Twitter bot which job is to, when run, upload picture of Snoop Dog with quote and few hashtags. Problem is when I run my code, it throws Tweetinvi.Exceptions.TwitterException: Forbidden error. I have tried searching for fix, but only thing I have found was just answers for meaning of error. Here is a part of code (rest are quotes, APIs and Tokens).
byte[] ImageBytes = File.ReadAllBytes("snoop.jpg");
TwitterClient UserClient = new TwitterClient(APIKey, APISecret, AccessToken, AccessSecret);
IMedia ImageIMedia = await UserClient.Upload.UploadTweetImageAsync(ImageBytes);
ITweet TweetWithImage = await UserClient.Tweets.PublishTweetAsync(new PublishTweetParameters(SnoopQuotes[RandNum.Next(10)] + "#ZemanNaUlici #SSPSNotGood #CyberMeansPrestige") { Medias = { ImageIMedia }});
Error is show here:
IMedia ImageIMedia = await UserClient.Upload.UploadTweetImageAsync(ImageBytes);
I would have loved some help, thank you.
PS: I am here for first time and english is not my primary language, so sorry if there are some mistakes.
Upvotes: 0
Views: 428
Reputation: 71
I faced the same thing and found this video had all the answers. https://youtu.be/aOlp3vXohB0
You need to upgrade your application in the developer portal to "Elevated", enable read/write on your posts and regenerate the API keys.
Upvotes: 0