Repository navigation
feat(content): pick Webflow or the webhook when sending pages to the CMS (Send to CMS #1331, phase 2 part 4: send target) - #1506
Conversation
…o CMS ansvisor#1331, phase 2 part 1: Webflow connection) A brand connects its Webflow site with a site token, kept by Composio as an API-key connected account under the brand's own Composio user, picks the collection pages go to and which of its fields takes the body, meta title, meta description and JSON-LD. 00283 adds brand_cms_connections (members read; the server writes for admins and managers). Routes under /api/cms/brands/:brandId/webflow connect, list collections and fields with a suggested map, save the map and disconnect. The token is never stored, logged or sent back. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…refusals narrowly (pre-push review) - A new token is a second Composio account until the first is removed, so connect with allowMultiple; once the new one is saved, the brand's other Webflow accounts go (forgetWebflowAccounts), and a disconnect removes them all, keeping the row when Composio can't. - Writes are tied to the account the request read: a map checked with a token replaced meanwhile isn't saved (409 changed), a late refusal marks only its own token, and a disconnect leaves a token connected meanwhile. - Only a 401 or a missing Composio account is auth_failed; a 403 is no_access and changes nothing; a successful read connects a refused connection again. - A collection's fields are given only for one on a site the token reaches. - A missing brand answers not_found; a required field can't be the JSON-LD's. - Unused exports dropped; composio.test.js covers the Webflow helpers. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ction as draft items (Send to CMS ansvisor#1331, phase 2 part 2: Webflow send) POST /api/content-drafts/send takes target 'webflow': each page becomes a draft item in the brand's collection (00283) by its field map, or updates the item its last send made there (a new one when it was deleted in Webflow). Webflow's rich text has no tables, so a table goes as a list; images wait for workspace files (CHAT-06); the meta description falls back to the page's opening words; JSON-LD goes as its JSON to its own field. The same 200 a day, 25 per send and pause apply. 00284 adds the delivery's target and the item's collection, and reserve_content_deliveries takes the target ('webhook' by default, so the earlier API still works). A token Webflow refuses marks the connection auth_failed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… as they are (pre-push review) - A table cell keeps its paragraphs, items and lines a space apart, and its links; a table a figure wraps is kept, a table in a cell read once; words or items outside a block become paragraphs; comments go; a picture counts as one image. - A slug with nothing Latin left falls back to the draft's id, the same on every send, not the delivery's. - 00284: a second Webflow send of a page while one is queued is refused under the cap's lock (in_progress), so two sends can't make two items. - The item's id is kept even when the delivery's row was written meanwhile. - A batch stops once Webflow refuses the token, closing the rest. - The webhook callback answers only for webhook deliveries. - An emptied JSON-LD field clears the item's old one; every "<" in it is escaped; the opening words stay within 160 characters. - A taken slug says what to do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… in Settings › Integrations (Send to CMS ansvisor#1331, phase 2 part 3: Webflow card) A Webflow card under the product catalog: admins and managers paste the brand's site token (sent from the browser to the API's proxy once, never through a server action), pick the site and collection pages go to, and which field takes the page content, meta title, meta description and JSON-LD (the collection's suggested map first), replace the token and disconnect; members see where pages go. A refused token asks for a new one; a connection changed meanwhile is read again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…CMS (Send to CMS ansvisor#1331, phase 2 part 4: send target) Once Settings has the brand's Webflow collection ready, the editor's and the Library's Send dialogs offer where pages go: Webflow (a draft item in the collection, the first choice) or the workflow's webhook, remembered per brand in this browser. A Webflow send says whether the item was made or updated and what Webflow's rich text couldn't keep (tables as lists, images not yet); its refusals are named; the Library marks a page sent there as a draft item in Webflow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ow isn't ready (pre-push review) - A brand's Webflow that can't be read holds the send, with Try again, instead of reading as no Webflow and sending to the webhook. - Webflow connected but not ready (its token refused, no collection) shows in the picker, off, with what to do; the webhook is then picked in view. - The description is neutral until the target is read. - The bulk dialog clears a refusal when the target changes, and says a page (not "this page") is already on its way to Webflow. - A collection without a name reads as "your collection". - Tests: a send held while reading, a failed read and Try again, the remembered choice read back, not-ready Webflow, the last send's line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
left a comment
There was a problem hiding this comment.
Needs changes: one fix before merge, since this ships to every brand with the next web deploy.
What I checked:
- Without Webflow (not set up, or not connected), the three dialogs send to the webhook as before, with no choice shown. They send
target: 'webhook', which is also the API's default, and the phase-1 tests now pass it. - When Webflow shows. The choice shows only when the API says the server has Webflow set up and the brand's connection is connected, with a collection and a body field. That's the same check
webflowFormakes before a send. Webflow connected but not ready shows off, with what to do, and the webhook is picked where the person sees it. A failed read holds Send with Try again, and the description stays neutral while the read is under way. The choice is remembered per brand in localStorage, with every access in try/catch. - The target is fixed at Send. The single dialog sends to the target picked when Send is pressed. The bulk send takes it once for all of its requests, and the choice is hidden once pages have gone, so a send of several requests can't change target partway through. The picker is off while sending.
- After a send. The toasts read #1504's answer (
updated, andchangedwith its tables and images, as ICU plurals). A Webflow failure reads "Webflow didn't take the page: …" with the API's own words, which never quote Webflow's. Every new refusal code has words in the single and the bulk dialog, andin_progressis worded for one page or a batch. - Last send and the Library mark. They read
targetfromcontent_draft_deliveriesandcontent_draft_last_deliveries(00284). The function'sd.*includes the new columns, and the types match the migration. - Drafts only. Every Webflow line says draft item, published in Webflow, and that's what #1504 does: it creates with
is_draft: true, and an update leaves the item's state as it is. - Roles. The dialogs are for admins and managers only, as before, and the API checks the role on send. The Webflow read is the GET every member may make.
Before merge:
send-to-cms-dialog.tsxand_bulk-send-dialog.tsx: before Send can be pressed, every Send to CMS dialog (editor, Library row, bulk) reads the brand's Webflow connection, and holds Send when that read fails. The web goes out on merge, while the API is deployed separately, so an API without #1503's route answers 404 and every brand's webhook sends are held with "Couldn't read where this brand's pages go." Any hiccup on that read later does the same. A webhook send doesn't need it: when the read fails (or answers 404), offer the webhook as today, with no Webflow choice, and keep Send open. Add a test for a failed read with a webhook set up.
We'll merge #1505–#1510 and #1507 once the API with #1503 and #1504 is deployed, so the Settings card doesn't show "Couldn't read" in the meantime either.
Low, follow-up (please fix before Webflow is turned on):
2. send-to-cms-dialog.tsx:209, and _bulk-send-dialog.tsx:294-306: when Webflow is connected but not ready, the webhook is picked. A brand that only sends to Webflow then gets no_webhook ("This brand has no webhook yet. Set one up in Webhook Settings on Content Opportunities."), which points the person to the wrong place. While webflow is { ready: false }, word no_webhook as Webflow not being ready, with the fix in Settings › Integrations (the picker's notReady line).
3. cms-target.tsx:128-155: both cards are tab stops, and the arrow keys do nothing. Follow the editor's Export dialog (_export-dialog.tsx:260-282): the picked card is the one tab stop, and the arrows move to the other card and pick it, skipping Webflow while it's off.
…-settings # Conflicts: # server/.env.example # supabase/schema.sql
…sed parts by their labels, tell members a refused token stops sends (review)
- A saved part whose field was deleted or changed type in Webflow is left
out when the fields arrive, so what's saved is what the pickers show.
- The API's problems name a part by its label ("Meta title: …"), in a
list read out as an alert; the token hint describes its field.
- With the token refused, a member reads that pages can't go to Webflow
until an admin or manager pastes a new one.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…_webhook for a Webflow not ready, and move between targets with the arrow keys (review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… so, and keep Try again off while sending (pre-push review) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks. All three are fixed, and the branch has #1505's head merged in (88f0667, no conflicts). Before merge (5af4f22):
Low:
A pre-push review added (c1ae682):
Web: format, lint (0 errors), typecheck, |
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good, with follow-ups to fix before it's turned on.
What I checked:
- Earlier items.
- Done. A failed read now means the webhook (
cms-target.tsx:71-73,:91-92). There's no Webflow card, the webhook description shows, and Send is open. Someone who picked or sent to Webflow before gets a quietrole="status"note with Try again, which is off while a send runs. Both dialogs have tests where the page goes towebhook. - Done. With Webflow connected but not ready,
no_webhooksends the person to Settings › Integrations. That holds in the single dialog (send-to-cms-dialog.tsx:208) and the bulk one (_bulk-send-dialog.tsx:305-307), both tested. - Done. The picked card is the one tab stop. The arrow keys move to the other card and pick it, and never pick Webflow while it's off (
cms-target.tsx:137-160). There's a test.
- Done. A failed read now means the webhook (
- Before the API is deployed. This covers the editor's dialog, a Library row's dialog and the bulk dialog:
- The Webflow read gets a 404 and counts as failed. While it's under way, Send is off and the description is neutral. Send also waits for the last-send read, as it already did.
- After that, the dialog is the one people have today: no choice, the webhook description, Send open.
- The page goes with
target: 'webhook'. The API before #1504 ignores that key (sendInputis a plainz.object), so the page goes to the webhook as it does now. - No one can have picked Webflow yet, so the "couldn't check" note doesn't show.
- The last-send line and the Library mark read
target, which 00284 (on prod) defaults towebhook, so they read as they do today. - Nothing that works today stops working.
- Merge
88f06678changes nothing beyond merging its parents, and the PR merges cleanly on main. - The bulk send's target is still fixed at Send.
sendkeeps the target from the render it started in.
Low, follow-up (please fix before Webflow is turned on):
cms-target.tsx:112, called atsend-to-cms-dialog.tsx:182and_bulk-send-dialog.tsx:283: a send now remembers its target even when the person had no choice. If Webflow can't be read, or is connected but not ready, the page goes to the webhook, and that send replaces the person's saved Webflow choice withwebhook. The next time Webflow is ready, the dialog starts on Your workflow. Someone who always sends to Webflow and just presses Send then sends to the webhook, which the not-ready card was added to prevent. Every brand that sends through its webhook today is hit the same way: once it connects Webflow, Webflow isn't the first choice the description promises. Remember a send's target only when both cards were offered (webflow?.ready).en.json:4309: in the editor, the Send to CMS button's hint now reads "Webflow, or your workflow through the brand's webhook" for every brand. That includes brands where Webflow isn't deployed, isn't set up or isn't connected. Keep the phase-1 hint, or mention Webflow only where the brand has it.
Summary
#1331, phase 2, part 4: choose where Send to CMS sends. Web only. Stacked on #1505 → #1504 → #1503: merge those first. The server already takes
target(#1504).The choice (
components/content/cms-target.tsx), in the editor's Send dialog, the Library row's dialog and the bulk dialog:localStorage, wrapped in try/catch).After a Webflow send
changed("2 tables went as lists. 1 image wasn't sent: add it in Webflow.").webflow_not_configured;no_webflow;webflow_refused;webflow_not_ready;in_progress, worded for one page or a bulk send.targetoncontent_draft_deliveries(00284). Before 00284, the line is just left out.Types:
types/supabase.tsgainstargetandtarget_collectiononcontent_draft_deliveriesandcontent_draft_last_deliveries.Related issue
Part of #1331 (phase 2, Webflow). Stacked on #1505 → #1504 → #1503.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
I checked it in the browser at 1024px, in light and dark, with the Webflow read stubbed in the page (no Composio here), from a Library row:
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): 0 errors; the 6 warnings are in files this PR doesn't touchyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)The pre-push review found two problems:
Their fixes are the last commit, along with the bulk dialog's stale refusal, its
in_progresswording, and the missing tests.Web:
yarn test(3,886 passed) andyarn buildpass.🤖 Generated with Claude Code