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.py
for more details, but you can either:- add these values to a
config.cfg
file (local deployment); or - set environment variables
TWITTER_CLIENT_ID
andTWITTER_CLIENT_SECRET
(cloud deployment) - set environment variables
NOTION_CLIENT_ID
andNOTION_CLIENT_SECRET
(cloud deployment)
- add these values to a
- Setup a pipenv environment, and install dependencies:
pipenv install
pipenv 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.
ngrok
for local use, or deploy to a cloud platform such as Heroku (aProcfile
is 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