Static app hosted on GitHub Pages with sync powered by GitHub Actions. No server to run.
- UI: React SPA at
https://<your-username>.github.io/twitter-sync-bot/ - Sync: "Sync now" triggers a workflow that fetches your Twitter likes (via cookies) and appends them to a Google Sheet.
- Data: Stored in your own Google Sheet; you can add agentic actions per row later.
-
Fork or create a repo (e.g.
twitter-sync-bot) and clone it. -
Enable GitHub Pages (Actions):
- Repo → Settings → Pages → Source: GitHub Actions.
-
Secrets (Repo → Settings → Secrets and variables → Actions):
Secret Description VITE_GOOGLE_CLIENT_IDGoogle OAuth 2.0 client ID (Web app) for sign-in. VITE_DEFAULT_SPREADSHEET_ID(Optional) Default spreadsheet ID so users don’t have to type it. VITE_GITHUB_REPO(Optional) Default repo (e.g. Mihirokte/twitter-sync-bot) for Sync now.TWITTER_COOKIES_JSONJSON string: {"auth_token":"...","ct0":"..."}(from x.com cookies).TWITTER_HANDLEYour X/Twitter username (no @).SPREADSHEET_IDTarget Google Sheet ID (from the sheet URL). SHEET_NAME(Optional) Sheet tab name; default TwitterLikes.MAX_LIKES(Optional) Max likes to fetch per run; default 100.GOOGLE_SERVICE_ACCOUNT_JSONFull JSON key of a service account that has access to the spreadsheet (share the sheet with the service account email). -
Push to
main
The Deploy to GitHub Pages workflow builds the app and publishes it. The site will be at:https://<owner>.github.io/twitter-sync-bot/
The site is serving repo source instead of the built app. You must use the workflow output:
-
Pages source
Repo → Settings → Pages → under "Build and deployment", set Source to GitHub Actions (not "Deploy from a branch"). Save. -
Deploy workflow
Repo → Actions → open "Deploy to GitHub Pages". Check the latest run onmain:- If it’s missing or failed, push a new commit to
mainand wait for the run to finish (green check). - If the build job failed, open it and read the log (e.g.
npm ciornpm run builderrors). - If the deploy job failed, check that the Pages environment exists and that the run has permission to deploy.
- If it’s missing or failed, push a new commit to
-
Exact URL
Use the exact repo name (case-sensitive in the path):
https://mihirokte.github.io/twitter-sync-bot/
(no trailing slash is fine; GitHub redirects.) -
Cache
Try a hard refresh (Ctrl+Shift+R) or an incognito window.
- Open the deployed URL and open Settings.
- Spreadsheet ID: Paste the ID of the Google Sheet you use for Twitter likes (same as
SPREADSHEET_IDif you want). - Sheet name: Tab name (e.g.
TwitterLikes), same asSHEET_NAMEin secrets. - GitHub repo:
owner/repoof this repo (e.g.yourname/twitter-sync-bot). - GitHub PAT: A personal access token with
repo(or at least enough to triggerrepository_dispatch). Used only to call the GitHub API when you click "Sync now"; stored in your browser (localStorage) only.
Click Sign in with Google so the app can read the sheet and show the table. Then Sync now will trigger the sync workflow and refresh the table after a few seconds.
- Clicking Sync now sends a
repository_dispatchevent to your repo. - The Sync Twitter likes to Sheets workflow runs: it uses
twikitwithTWITTER_COOKIES_JSONto fetch your recent likes, then appends new rows to the sheet via the service account. - Columns:
tweetId,author,authorHandle,content,tweetUrl,likes,retweets,action(set tosynced). You can changeactionlater for agentic steps (e.g.summarized,posted).
npm install
npm run devFor local sync (without GitHub Actions), use the Python script with config files:
pip install -r requirements.txt
# Create config.json (from config.example.json) and cookies.json
export GOOGLE_SERVICE_ACCOUNT_FILE=/path/to/key.json
export GOOGLE_SHEETS_SPREADSHEET_ID=your_sheet_id
python twitter_sync.pyThe app is built with base: "/twitter-sync-bot/" for GitHub Pages. If you use a different repo name, change base in vite.config.ts and redeploy.