In large orginizations you can be autosubscribed to hundreds of thousands of notifications. There is no bulk or easy way to mass unsubsribe. Even the API to unsubscribe is not bulk. As such this script can take O(days) to run for acounts with ~million subs.
- go to https://github.com/settings/tokens/new?scopes=repo to get an access token
- make sure to enable the
notificationscope - add the access token to
ACCESS_TOKENinsrc/main.ts - install nvm and node16
npm installnode main.js
- this takes forever, you have to delete each sub individually (no bulk API)
- both APIs used (list notification and delete notification) use the "core" API rate limit of 80 calls/min (1.3/s), can delete a max ~80/min or 5000/hr[0]. Some active Github accounts have 100,000's of subs which would take O(days). I had over 100,000.
- uses octokit
- Uses list notification API: https://docs.github.com/en/rest/activity/notifications#list-notifications-for-the-authenticated-user
- this API don't respect the "per page" parameter and only returns up to 50 subs per call
- Uses delete notification API: https://docs.github.com/en/rest/activity/notifications#delete-a-thread-subscription