# GHL Social Planner — LinkedIn scheduling (UI + API)

Condensed from GHL help docs + marketplace API docs, verified against the live OAuth token 2026-08-03.

## Scope status

The app scope set includes ALL `socialplanner/*` scopes
(account/oauth/post/csv/category/tag/statistics/comments, read+write). Verified by
inspecting the `scope` field of the stored token — no app changes needed for Social
Planner work. (Originally verified on V2; V3 was built with the same full scope set
2026-08-03.) **As of 2026-08-03 the V3 AGENCY token (168 scopes) is the primary
credential and it reads+writes RRR Social Planner directly** — no location token
needed (the "agency can't write" claim was a V2 scope gap).

## Verified live against RRR (2026-08-03)

- `GET /social-media-posting/4yTvHUHrmVuP8CgCt1Q9/accounts` with the V3 agency
  token → **200**, and **Rob's LinkedIn personal profile ("Rob Blake") is ALREADY
  CONNECTED** to RRR's Social Planner. Account id pattern:
  `<oauthId>_<locationId>_<profileId>_profile`. Company page status unknown —
  check the accounts list before telling him to connect anything.
- `POST /social-media-posting/4yTvHUHrmVuP8CgCt1Q9/posts` with the agency token →
  **422 validation errors (NOT 401)** = write access confirmed; the payload shape
  was wrong. Correct shape per the 422s:
  - `scheduleDate` (NOT `scheduledAt`) — required when `status` = `scheduled`/`in_review`
  - `type` ∈ `post|story|reel` (NOT `text`)
  - `userId` — required string (grab from `GET /users/?locationId=...`)
  - `media` — array (empty OK)
  - `accountIds` — array of ids from the accounts list

## UI path (Marketing → Social Planner)

1. Connect LinkedIn: Social Planner → gear (Settings) → **+ Connect a New LinkedIn
   Profile** (separate button for Company Pages) → LinkedIn login → approve.
   Supports BOTH personal profiles and company pages.
2. Schedule: New Post → Create New Post → pick account(s) → copy + media →
   publish action: Post now / Schedule for later / Recurring / Evergreen queue /
   Send for approval.
3. Other modes: **Upload A CSV** (bulk month-at-a-time), **Create RSS Post**
   (auto-post from feed), calendar drag/drop view, categories + watermark under
   Settings. LinkedIn supports custom video thumbnails in the composer.

## API path

Base `https://services.leadconnectorhq.com`, headers `Authorization: Bearer`,
`Version: 2021-07-28`. All paths are Sub-Account access type.

| Purpose | Endpoint |
|---|---|
| List connected accounts | `GET /social-media-posting/{locationId}/accounts` |
| Start LinkedIn OAuth (browser) | `GET /social-media-posting/oauth/linkedin/start` |
| Finish account link | `POST /social-media-posting/oauth/{locationId}/linkedin/accounts/{accountId}` |
| Create/schedule post | `POST /social-media-posting/{locationId}/posts` |
| Edit / delete | `PUT` / `DELETE /social-media-posting/{locationId}/posts/{id}` |
| List posts | `POST /social-media-posting/{locationId}/posts/list` |
| Bulk CSV | `POST /social-media-posting/{locationId}/csv` |
| Statistics | `POST /social-media-posting/statistics` |

Docs: marketplace.gohighlevel.com/docs → Social Planner section (create-post,
edit-post, etc.). Create-post body has per-platform `linkedinPostDetails` object.

## Pitfalls / constraints

- **The LinkedIn ACCOUNT connection is always a browser click-through** of
  LinkedIn's own OAuth — only the user can do it (their LinkedIn login). Once the
  account is connected, post create/schedule/edit is fully scriptable via API.
  (RRR's LinkedIn profile is already connected as of 2026-08-03 — this step is
  DONE for the personal profile.)
- Verified live 2026-08-03 on Test Sandbox: `GET .../accounts` returns 200 with
  empty `accounts` list on the sandbox location token — confirms the scope works
  end-to-end before any account is connected.
- Don't confuse with `adPublishing.*` LinkedIn endpoints — those are PAID ADS
  (LinkedIn Ads integration), not organic Social Planner posting.
- **Use the V3 agency token for RRR, not a location token** — the skill's old
  "location token required" guidance was corrected 2026-08-03 (see SKILL.md
  "Agency tokens CAN read+write" section).
