Claimed. Researching direct social publishing through an aggregator API (Zernio and alternatives) as a possible first step before direct YouTube OAuth. Findings will follow here.
Publish to the client's YouTube with thumbnail and title A/B tests#129
What
Publish an approved Project Output straight to the client's YouTube channel from Relay, and test title and thumbnail variants before picking a winner.
This is deliberately later work: it needs YouTube OAuth, per-workspace encrypted token storage with refresh, and Google app verification for the upload scopes. None of that is worth building before approve/lock, the frame player, and stage assets ship.
Notes
- Blocked on the approve + lock issue: only an approved, locked version may be publishable, and the approval is the editor's authorisation to upload.
- Follow the existing per-workspace secret pattern (
aiProviderKeysstores ciphertext plus IV) rather than inventing a second encryption path; tokens are never logged and never returned to the client. - YouTube Data API gives view and CTR-adjacent data per video; a variant test has to map each published variant to its own video or to a thumbnail set with a changeover time. Decide that model before writing code.
- Unverified apps hit a hard cap on users and cannot publish publicly. Verification is a calendar item, not an engineering task, so it gates the release.
Acceptance criteria
- An editor connects a YouTube channel by OAuth for the active workspace, with scopes limited to uploading and managing videos on that channel; the Google consent screen names exactly those scopes.
- Tokens are stored encrypted per workspace, refreshed automatically, and revocable from Settings; no token appears in a query response, a log, or an error message.
- Publishing is available only for an approved, locked Media Version, and requires an explicit confirm step showing title, description, tags, visibility, and scheduled time.
- A publish records the video id, channel, variant, and publishing user against the Project Output, so it can be found again without re-querying by title.
- Title/thumbnail A/B: two or three variants per video, each with its own thumbnail upload and title, switched in and out over a fixed window.
- Per-variant metrics are collected for the test window, and the winner is chosen automatically at the end (or pinned manually) with the numbers shown before applying.
- Applying a winner updates the live video's title and/or thumbnail, and the change is logged with who applied it.
- Failed or interrupted uploads surface with a retry and never leave a Project marked published without a video id.
- Google app verification for the requested scopes is completed before public availability, and the unverified limitation is documented in the repo while it is pending.
- Tests cover token refresh, the approved-version gate, variant selection math, and the retry path.
- Manual check: publish an approved cut to a private test channel, run a two-variant thumbnail test, and apply the winner.
Main branch review (2026-10-19)
Reviewed 17cd594.
Status: deferred and not implemented on main. Main supports YouTube links/embeds through convex/domainValidators.ts and src/components/review-video-player.tsx; it does not provide YouTube channel OAuth, publishing, refresh-token storage, or variant metrics/winner application.
Dependencies are #103 (approved/locked versions), #106 (hosted cuts/player), and #107 (stage assets), with external Google verification remaining a separate release requirement. convex/aiCredentials.ts provides an encryption/ownership pattern to reuse, not a YouTube integration or a reason to reuse the AI-key table. Keep the later label and all publishing/A-B criteria open. No Google account connection or upload was attempted.
Mirrored issue: https://github.com/Zns-Nexus/Relay/issues/40
Claimed. Researching direct social publishing through an aggregator API (Zernio and alternatives) as a possible first step before direct YouTube OAuth. Findings will follow here.
Research: publishing through an aggregator API (2026-10-28)
Recommendation: use Zernio (formerly Late, getlate.dev) with one Relay-held API key and one Zernio profile per workspace. Allow pasted workspace keys later for agencies that already pay Zernio.
- Connect:
GET /v1/connect/{platform}?profileId=...returns a hosted OAuth URL. Zernio holds the platform tokens, so Relay stores only profile and account ids. This avoids running our own Google OAuth app review for basic publishing. - Publish:
POST /v1/postswith anIdempotency-Key. The video goes in as a public HTTPS URL or through a presigned PUT (up to 5 GB). Do not stream masters through a Convex action: Node actions get 512 MB and HTTP action responses are capped at 100 MB. - Status: a Convex
httpActionchecks the HMACX-Zernio-Signatureagainst the raw body, returns 2xx within 5 seconds and dedupes on the event id. PollingGET /v1/posts/{id}is only a fallback. - YouTube: one title, a custom thumbnail (2 MB, not for Shorts), visibility, scheduling and analytics are supported. Title/thumbnail A/B tests are a YouTube Studio feature with no aggregator API, so that part of this issue still needs the YouTube Data API or stays manual.
- Cost: billed per connected account across the whole team. The first 2 are free, then $6 each for accounts 3-10, $3 for 11-100 and $1 after that. Profiles and posts are free. X calls are passed through at X's rates.
- Alternatives: Upload-Post (cheaper, publish only), Ayrshare (same one-key, many-profiles shape, higher price, needs our own X app), Postiz (self-host, keeps files off a vendor bucket). Buffer's API key covers only one Buffer account.
- Risks: the approved cut leaves Relay for Zernio and then the platform, and the publish UI should say so. One shared key also means a shared rate limit and shared ban risk. Zernio account and post ids lock us in.
- SDK:
@zernio/nodereleases several times a day. Pin a version at least 7 days old, or call the REST API withfetch.
The publish gate stays as written above: only an approved, locked Media Version can be published.
Full notes with sources: .scratch/social-publishing/research.md (local).
Research: publishing through an aggregator API (2026-10-28)
Recommendation: use Zernio (formerly Late, getlate.dev) with one Relay-held API key and one Zernio profile per workspace. Allow pasted workspace keys later for agencies that already pay Zernio.
- Connect:
GET /v1/connect/{platform}?profileId=...returns a hosted OAuth URL. Zernio holds the platform tokens, so Relay stores only profile and account ids. This avoids running our own Google OAuth app review for basic publishing. - Publish:
POST /v1/postswith anIdempotency-Key. The video goes in as a public HTTPS URL or through a presigned PUT (up to 5 GB). Do not stream masters through a Convex action: Node actions get 512 MB and HTTP action responses are capped at 100 MB. - Status: a Convex
httpActionchecks the HMACX-Zernio-Signatureagainst the raw body, returns 2xx within 5 seconds and dedupes on the event id. PollingGET /v1/posts/{id}is only a fallback. - YouTube: one title, a custom thumbnail (2 MB, not for Shorts), visibility, scheduling and analytics are supported. Title/thumbnail A/B tests are a YouTube Studio feature with no aggregator API, so that part of this issue still needs the YouTube Data API or stays manual.
- Cost: billed per connected account across the whole team. The first 2 are free, then $6 each for accounts 3-10, $3 for 11-100 and $1 after that. Profiles and posts are free. X calls are passed through at X's rates.
- Alternatives: Upload-Post (cheaper, publish only), Ayrshare (same one-key, many-profiles shape, higher price, needs our own X app), Postiz (self-host, keeps files off a vendor bucket). Buffer's API key covers only one Buffer account.
- Risks: the approved cut leaves Relay for Zernio and then the platform, and the publish UI should say so. One shared key also means a shared rate limit and shared ban risk. Zernio account and post ids lock us in.
- SDK:
@zernio/nodereleases several times a day. Pin a version at least 7 days old, or call the REST API withfetch.
The publish gate stays as written above: only an approved, locked Media Version can be published.
Full notes with sources: .scratch/social-publishing/research.md (local).
Connect and publish through Zernio is now tracked in #146. This issue keeps the title/thumbnail A/B tests, which need the YouTube Data API.