Tos safe social share helper

From CarlosCaPe/octorato · View interactive version

Tos safe social share helper is an AI agent skill from the GitHub repository CarlosCaPe/octorato. Architectural pattern for cases where a client wants to "auto-publish to social platform X" but the platform's ToS forbids API automation for that surface (FB Groups post-2024, IG personal accounts, LinkedIn personal feeds, etc.). Build a 1-click manual flow with clipboard-prefill + deep-link + trac

How to use this skill

Skill file

ToS-Safe Social Share Helper

When this skill fires

Client says some variant of: "auto-publish to FB Groups", "post to N groups", "share to my followers/communities automatically". Before building a bot, run the constraints check below.

Constraints check (5 min):

  1. Is there an OFFICIAL API for posting to this surface? Check the platform's current Graph API / REST docs (not Stack Overflow circa 2019).
  2. If yes — is the required permission/scope available to third-party apps right now? (Many got deprecated.)
  3. If yes — does the user have the platform role required (admin, moderator, business account)? Members are usually NOT enough.

If any answer is NO, the API path is dead. Don't write the bot. Build this share-helper instead.

Three paths and their honest tradeoffs

| Path | Legal | Account risk | UX cost | Build cost |

|------|-------|--------------|---------|------------|

| A. Share helper (this skill) | ✅ 100% ToS-compliant | Cero | Manual ~5-15s per (post,target) cell | ~4h |

| B. Browser automation as the user (Playwright + session persist) | ⚠️ Violates ToS | High — banhammer the user's account | Full auto | ~12h + maintenance |

| C. Paid boost / promoted post | ✅ Pago | Cero | Auto but $$ | ~2h + ongoing budget |

Default to A. Only consider B if the client explicitly accepts the account-loss risk in writing AND uses a dedicated account (never the personal one).

The pattern (4 pieces)

1. Schema — targets list + share tracking

Two D1 tables:

CREATE TABLE IF NOT EXISTS <feature>_share_targets (
  id              INTEGER PRIMARY KEY AUTOINCREMENT,
  external_id     TEXT    NOT NULL UNIQUE,    -- e.g. FB group id, IG handle
  name            TEXT    NOT NULL,            -- human label for UI
  url             TEXT    NOT NULL,            -- direct deep-link to compose
  role            TEXT    NOT NULL DEFAULT 'member' CHECK (role IN ('member','admin','mod')),
  enabled         INTEGER NOT NULL DEFAULT 1  CHECK (enabled IN (0,1)),
  display_order   INTEGER NOT NULL DEFAULT 0,
  added_at        TEXT    NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
);

CREATE TABLE IF NOT EXISTS <feature>_shares (
  id              INTEGER PRIMARY KEY AUTOINCREMENT,
  source_post_id  INTEGER NOT NULL REFERENCES <feature>_posts(id) ON DELETE CASCADE,
  target_id       INTEGER NOT NULL REFERENCES <feature>_share_targets(id) ON DELETE CASCADE,
  shared_at       TEXT    NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),
  shared_by_user  TEXT,
  status          TEXT    NOT NULL DEFAULT 'shared' CHECK (status IN ('shared','skipped','removed','failed'))
);
CREATE UNIQUE INDEX ux_<feature>_shares_post_target ON <feature>_shares(source_post_id, target_id);

2. Two API endpoints (gated by your session/auth)

Auth pattern: cookie session (reuse existing auth — don't roll your own).

3. The helper page

SSR page that renders, per (post × target) cell, a button that:

  1. Copies the post caption to the user's clipboard (navigator.clipboard.writeText)
  2. Opens the target's compose URL in a new tab (window.open(url, '_blank', 'noopener'))
  3. Marks the share as shared optimistically (UI flips green); on API error rollback.

A secondary OK/✕ button toggles the shared status manually (mistakes, removals, replays).

Key client-side detail: use event delegation on a single document.click listener — DON'T attach handlers to each button. With 12 posts × 10 targets = 120 buttons, you avoid 120 listeners.

4. Optional: humanized share-now reminder

If the user wants to be "reminded" to do today's shares: cron at posting times sends them a notification (email / WhatsApp / Slack) with deep-link to the helper page. Don't auto-share — just nudge.

Anti-patterns to refuse

Telemetry the bot couldn't give you

Because every share is a recorded click, you get:

Concrete cost calibration

Related skills / patterns

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.