Skip to content

Send content from the Content Editor and Library to a CMS (webhook first, then WordPress and Webflow) #1331

Done

Description

@cihan-gyk

Summary

People write and optimize pages in the Content Editor, then copy the HTML by hand into their site. This issue proposes a Send to CMS flow from the editor and the Library. The page lands in the customer's CMS as a draft: Ansvisor never publishes on its own (spec v2 §6). The published URL comes back to Ansvisor, so the draft becomes Published and tracking starts (CE-013).

The plan is in two phases.

  1. Webhook first. We already have a webhook for Content Opportunities, so this reuses it. It reaches every CMS on day one: directly for self-hosted sites, and through Zapier / Make / n8n for the rest.
  2. Native connectors after that, by demand: WordPress, then Webflow. Shopify and Wix come later.

What exists today (to reuse)

Piece Where Reuse
Webhook configs per brand: URL, secret, subscribed events webhook_configs, 00198 (events with an allow-list constraint) Add a new event, content_draft.sent (new migration to extend the constraint)
Settings UI with event checkboxes web/src/app/[locale]/(dashboard)/dashboard/content/_webhook-settings.tsx, allowed events in web/src/lib/actions/content.ts Add the event's checkbox and copy
Delivery server/src/lib/webhook-dispatch.js dispatchBrandWebhook(brandId, payload): X-Webhook-Secret header, 15 s timeout, sent/failed counts Send the content package with it
Send-route pattern server/src/routes/content.js (opportunity.sent: no_webhook / webhook_not_subscribed errors, payload building) Same checks and error codes for drafts
Callback from the workflow server/src/routes/webhook-content-callback.js: POST /webhooks/content/:id/status, per-secret and failed-auth rate limits, webhookSecretsMatch A sibling route for drafts that reports the CMS item id and published URL
Publishable HTML publishableHtml (Copy HTML), sanitizeDraftHtml Stored body_html is untrusted (see #1259's review), so always send the sanitized, publishable version

Phase 1: webhook (estimate 1–2 PRs)

  1. Content package. One JSON shape for every target:
    • event: "content_draft.sent", sentAt;
    • draft: id, title, slug (from the title, editable later), metaTitle, metaDescription, html (publishable, sanitized), jsonLd[], pageType, method (create / optimize), sourceUrl (the page being optimized), language;
    • brand: id, name, primary domain;
    • callback: { url, method: "POST" } for reporting back.
    • Version the shape (schemaVersion: 1) so templates don't break later.
  2. Send from the editor. A Send to CMS button in the header. Before sending, save what's waiting (autosave settle). Show "Sent · {date}" afterwards, with "Send again".
  3. Send from the Library. "Send to CMS" in the row menu (feat(content): archive, delete and set a status from the Library's rows #1328) and as a bulk action on selected rows. One delivery per draft. Cap the batch size.
  4. Delivery record per draft. A new table, e.g. content_draft_deliveries: draft_id, target (webhook now, connector names later), status (sent / failed / published), external_id, published_url, sent_at, sent_by, error. It drives the "Sent" state, retries, and the Library filter.
  5. Callback route. POST /webhooks/content-drafts/:id/status with { status: "published" | "failed", externalId?, url? }, authenticated by the webhook secret like the opportunity callback. A published URL:
    • sets the draft to Published and stores published_url;
    • keeps a publish version in History (00215);
    • starts tracking (CE-013).
  6. Guides and templates. Short docs plus ready-made Zapier / Make / n8n templates, e.g. "Ansvisor webhook → create a draft post": WordPress, Webflow CMS item, Shopify blog article, Wix draft post, Framer CMS (via Make). Each one calls the callback with the CMS item's URL.

Phase 2: native connectors (one PR each, by demand)

Every connector implements the same small interface, send(package, connection) → { externalId, url, status }, and writes the same delivery record. Shared rules:

  • Drafts only: create or update as a draft in the CMS.
  • Idempotent: a draft that already has an external_id for that target updates the item instead of creating a second one.
  • HTML the target accepts. Webflow's rich text has no tables, so convert tables or move them to an embed. Wix stores Ricos JSON, not HTML.
  • JSON-LD where the target takes it: a Webflow custom-code field, a WordPress plugin or custom HTML block, a Shopify metafield / theme.
  • Images wait for workspace files (CHAT-06); until then they aren't sent.
CMS Route Notes
WordPress (first) Direct REST API + Application Passwords (site URL, user, app password). No OAuth app or app review Composio's toolkit only covers WordPress.com and Jetpack-connected sites, and only draft posts. Most business sites are self-hosted, so call the REST API directly (posts and pages, status: draft)
Webflow (second) Composio (server/src/lib/composio.js already runs managed connections and tools.execute for Search Console / Analytics) with API-key auth (site token) Tools exist: WEBFLOW_CREATE_COLLECTION_ITEM, WEBFLOW_UPDATE_COLLECTION_ITEM, WEBFLOW_UPDATE_PAGE_METADATA. Needs a field-mapping step (collection + fields: name, slug, body, meta)
Shopify (later) Composio, OAuth only Composio has no managed OAuth app for Shopify, so we register our own Shopify app. Create article / page tools exist; an update tool wasn't visible in the docs, so check before relying on it. Align with the e-commerce "Push to Shopify" work (SHOP-009) so there's one Shopify connection
Wix (later) Composio, OAuth or API key Blog draft tools to be confirmed; needs HTML → Ricos conversion
Framer Webhook / Make No Composio toolkit seen; CMS writes go through Framer's plugin / API model. Research before building

Note: none of these toolkits has a Composio-managed OAuth app. OAuth means registering our own app per CMS (with reviews on Shopify / Wix). API-key auth (Webflow, Wix) avoids that for a first version.

Security and permissions

  • Who can send: admins and managers (proposal), as for other org-wide writes. The Library bulk action follows the same rule.
  • Secrets: CMS credentials and API keys live in Composio (connectors) or encrypted server-side (WordPress app passwords). They are never sent to the browser or logged.
  • The callback route is public by design: rate-limited, secret-checked and constant-time compared, mirroring the opportunity callback.
  • The webhook URL is the brand's own setting, as today. Native connectors call only the CMS's API host.

Open questions

  1. Who can send to a CMS: admins and managers, or every member?
  2. Slug and meta: derived automatically (title, first paragraph), or editable fields in the editor before sending?
  3. Bulk limit for the Library (e.g. 25 per send)?
  4. Order of native connectors after the webhook: WordPress → Webflow → Shopify → Wix?
  5. Should "Send to CMS" also exist on Action Center content tasks (feat(content): link Action Center writing tasks and Content Editor drafts both ways #1306)?

Out of scope

  • Publishing live from Ansvisor: the CMS keeps the publish step.
  • Image upload (CHAT-06).
  • Two-way sync of later edits made in the CMS.

Related

CE-013 (Published state and tracking), CE-021 (export), SHOP-009 (Push to Shopify), 00198 (webhook event subscriptions), 00215 (History), #1328 (Library row menu).

Activity

  1. cihan-gyk commented on Oct 21, 2026

    @cihan-gyk
    CollaboratorAuthor

    Decisions (2026-10-22) on the open questions:

    1. Who can send: admins and managers only. Checked on the server; the buttons are hidden for other roles.
    2. Slug and meta: filled automatically and editable before sending.
      • The Send to CMS dialog prefills the slug (from the title), the meta title (the title, up to ~60 characters) and the meta description (the first paragraph, up to ~155 characters).
      • Edits are saved on the draft and reused on the next send.
      • No AI call, so no AI cost.
    3. Bulk limits:
      • Up to 25 drafts per Library bulk send, delivered one at a time in a background job with a short pause.
      • At most 200 deliveries per organization per day.
      • Webhook delivery has no AI cost; the limits keep us under the CMSs' rate limits (e.g. Webflow's per-minute cap).
    4. Native connector order: we don't collect or look up customers' domains for this (privacy).
      • Our own site, www.ansvisor.com, runs on Webflow, so Webflow goes first: we can test it end to end on our own site.
      • Then WordPress, Shopify, Wix and Framer, by general market share and effort.
    5. Action Center content tasks: no "Send to CMS" there.

    Phase 1 (webhook) can start once you're OK with the plan.

  2. gkhngyk commented on Oct 23, 2026

    @gkhngyk
    Contributor

    Thanks, the plan looks good:

    • admins and managers only, checked on the server;
    • slug and meta filled automatically and editable before sending;
    • 25 drafts per bulk send, 200 deliveries a day;
    • Webflow as the first native connector;
    • no Send to CMS in the Action Center.

    Go ahead with phase 1 (webhook).

  3. cihan-gyk commented on Oct 24, 2026

    @cihan-gyk
    CollaboratorAuthor

    Scope note for phase 1 (from the #1439 review):

  4. 13 remaining items

  5. added
    enhancement
    content
    integrations
    on Nov 26, 2026
  6. gkhngyk commented on Nov 26, 2026

    @gkhngyk
    Contributor

    Closing this as done. Everything planned here has shipped on main:

    HubSpot was added later in #2271. New targets get their own issues, such as Ghost in #2157.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentenhancementintegrations

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions