# Social Distribution Setup (/docs/social/setup)



## 1. Install the layer [#1-install-the-layer]

From the layers catalog → **Social Distribution** → **Install**. The
`initialize` command runs `social-distribution-plan` and the layer
appears in your project's layer list.

One Social Distribution layer instance is bound to **one** connected
social account (`config.social.socialAccountId`). To post to both
Instagram and TikTok, install two layer instances.

## 2. Connect a social account [#2-connect-a-social-account]

See:

* [Connect Instagram](/docs/social/connect-instagram)
* [Connect TikTok](/docs/social/connect-tiktok)

## 3. Pick a distribution mode [#3-pick-a-distribution-mode]

Configured via `config.distributionMode`:

* **`automatic`** — Layers picks 1–3 default times per day based on the
  account's current "temperature" (cold = 1 slot at 10:00, warm = 2 slots
  at 10:00 and 15:00, hot = 3 slots at 10:00 / 15:00 / 19:00, all in the
  project timezone).
* **`custom`** — supply your own `HH:MM` times in
  `config.schedule.times` (project timezone).
* **`manual`** — Layers does not create slots; you build the schedule
  post-by-post.

## 4. Posts per day (custom mode) [#4-posts-per-day-custom-mode]

In `custom` mode, posts per day equals the length of
`config.schedule.times` (1–5 allowed). Example: three times a day —

```json
{
  "distributionMode": "custom",
  "schedule": { "times": ["09:00", "13:00", "18:00"] }
}
```

Times are in the project's timezone.

## 5. Generation mode [#5-generation-mode]

Controls whether the distribution layer auto-requests content
generation to fill empty slots:

* `config.generationMode = "automatic"` — empty slots trigger generation.
* `config.generationMode = "manual"` (default) — you manually generate
  content that then attaches to the next empty slot via
  `attach-to-schedule`.

## 6. Publish on/off [#6-publish-onoff]

`config.willPublish` gates the entire publishing loop. Leave it `false`
while testing; set `true` to let `process-due` actually publish at slot
time.

## 7. Account health [#7-account-health]

Instagram and TikTok access tokens are stored encrypted in the
[Layers credential vault](/docs/trust/vault). If token refresh or an
API call fails with an auth error,
`social_accounts.metadata.token_error` is set and the account is flagged
unhealthy. Reconnect from Project Settings → Social accounts to clear.

## 8. Activate [#8-activate]

Save settings. Triggers:

* `refresh-schedule` — re-runs `social-distribution-plan` immediately
  whenever schedule config changes.
* `refresh-schedule-scheduled` — re-runs nightly at `0 3 * * *` UTC.
* `process-due` — runs every minute, publishing posts whose slot time
  has arrived.
* `recover-overdue` — runs every 5 minutes, re-slotting ready/failed
  posts that missed their original window.
