substack-dashboardlisted
Install: claude install-skill polmarza/substack-stats-skill
# Substack dashboard
Substack exposes no public API, but its writer dashboard talks to a private JSON
API under `/api/v1/…` that works with the logged-in browser session. This skill
drives that API from the integrated browser, saves one JSON file per publication,
and builds a single self-contained `dashboard.html` the user can open, keep, or
re-generate later.
The user must be an **admin** of the publications. You never handle their
password or cookie directly — they log in themselves in the browser; the session
does the rest.
## The flow
Do these in order. Keep the user informed at each step; logging in is the only
thing they must do by hand.
### 1. Open the browser and confirm the session
Open the integrated browser at `https://substack.com/home`. Then check whether a
session exists by running this in the page (via the browser's JS tool):
```js
(await fetch('/api/v1/user/profile/self', { credentials: 'include' })).status
```
- **200** → logged in. Read the body to list the publications (next step).
- **anything else** → ask the user to sign in at `https://substack.com/sign-in`
in that same browser window, then wait and re-check. Do **not** type their
email code or password yourself — that is theirs to enter. If the email code
never arrives, tell them they can use "Sign in with password" on that screen.
### 2. Discover the publications they administer
Fetch the profile and keep the publications where the user's role is `admin`:
```js
const me = await (await