A simple Python + Flask web app that demonstrates how to export Twitter Bookmarks to a Notion page.
You can try a deployed version of the app running on Glitch.
- Obtain consumer key and secret from the Twitter Developer portal. The app should be configured to enable Sign in with Twitter.
- Obtain OAuth client ID and OAuth client secret from the Notion Developer portal. See
twitter_auth.pyfor more details, but you can either:- add these values to a
config.cfgfile (local deployment); or - set environment variables
TWITTER_CLIENT_IDandTWITTER_CLIENT_SECRET(cloud deployment) - set environment variables
NOTION_CLIENT_IDandNOTION_CLIENT_SECRET(cloud deployment)
- add these values to a
- Setup a pipenv environment, and install dependencies:
pipenv installpipenv shell
- Start the app:
python3 ./twitter_auth.py; orgunicorn twitter_auth:app
Note: the app must have an Internet-accessible URL - do not attempt to connect via localhost, as this will not work. You can run a tunnel e.g.
ngrokfor local use, or deploy to a cloud platform such as Heroku (aProcfileis included).
Open a browser window on your demo app's external URL. Don't click the buttons yet!
Finally, add the appropriate redirect URLs in developer portal for both Notion and Twitter. Also add these, as environment variables TWITTER_REDIRECT_URI and NOTION_REDIRECT_URI in your config.cfg (local deployment) or as environment variables (cloud deployment).
Twitter Developer Portal
Notion API Docs
Original version of Twitter OAuth login by Jacob Petrie
https://twitter.com/jaakkosf
https://github.com/jaakko-sf/twauth-web