linvi / tweetinvi

Tweetinvi, an intuitive Twitter C# library for the REST and Stream API. It supports .NET, .NETCore, UAP (Xamarin)...
MIT License
1.01k stars 220 forks source link

Filtered Streams giving me 403 Forbidden #1179

Open gabs247 opened 2 years ago

gabs247 commented 2 years ago

I'm just trying to follow the TweetInvi and Twitter API documentation to do something pretty simple with the streams.

When I run the Twitter API via cURL with the BearerToken generated in my Twitter Dev account, it works.

var userClient = new TwitterClient(consumerKey, consumerSecret);
var stream = userClient.Streams.CreateFilteredStream();
stream.AddTrack("@TwitterUsername");
stream.MatchingTweetReceived += (sender, eventReceived) =>
{
    // do stuff
};
await stream.StartMatchingAnyConditionAsync();

When I run this code though, I get:

\n\n\nError 403 With URL: https://stream.twitter.com/1.1/statuses/filter.json?track=%40twitterusername&stall_warnings=true&tweet_mode=extended This URL looks to be retired now? </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Scobiform"><img src="https://avatars.githubusercontent.com/u/9046630?v=4" />Scobiform</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>For usernames use AddFollow. Use AddTrack for text. </p> <p>Response code 403 is Forbidden. <a href="https://developer.twitter.com/en/support/twitter-api/error-troubleshooting">https://developer.twitter.com/en/support/twitter-api/error-troubleshooting</a></p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>