I'm encountering a 403 Forbidden error when calling the Twitter API v2 streaming endpoint (/2/tweets/search/stream/rules). The error message states:
“When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.”
I am using a BASIC plan (monthly $200), and I have ensured that the app is attached to a project in the Twitter Developer Portal. I have also regenerated and updated the BEARER_TOKEN locally and in Heroku’s Config Vars. However, the issue persists when executing the following call in my application:
stream.add_rules(tweepy.StreamRule("to:FortuneBotJP"))
The Heroku logs show:
2025-02-26T20:25:26.639520+00:00 app[worker.1]: tweepy.errors.Forbidden: 403 Forbidden
2025-02-26T20:25:26.639530+00:00 app[worker.1]: When authenticating requests to the Twitter API v2 endpoints, you must use keys and tokens from a Twitter developer App that is attached to a Project. You can create a project via the developer portal.
The app is hosted on Heroku (app name: fortune-bot-jp), running Python 3.10 with Tweepy 4.14.0. I would appreciate any guidance on verifying the project attachment, ensuring BASIC access is properly applied, or any additional steps to resolve this issue. If further logs or details are needed, please let me know.