Repository navigation
feat(content): send pages to the HubSpot blog as draft posts - #2271
Merged
Merged
Conversation
HubSpot, part 4 of ansvisor#2140 (stacked on ansvisor#2265): Send to CMS can put a page on the brand's HubSpot blog as a draft post, blog posts first as the owner asked (site and landing pages come after). - 00522: content_draft_deliveries.target takes 'hubspot' (the blog's id in target_collection, the post's in external_id), and reserve_content_deliveries keeps a page from going to HubSpot twice at once. 00521 stays kept for marking contacts. - On the HubSpot card, with "Send pages to HubSpot as drafts" allowed: "Blog posts go to", the HubSpot account's blogs (GET/PUT /api/hubspot/brands/:brandId/blogs and /blog). Without HubSpot's content scope it asks to connect HubSpot again. - The target (NATIVE.hubspot): only with HubSpot set up, connected, the plan's crm_integrations, consent to send pages and a blog picked; each refusal named. A post's title, slug, meta title and description and featured image go as the post's own, the JSON-LD in its head. A page's next send updates its post's draft; one deleted in HubSpot gets a new one. Nothing is published. - Published there since: read when the Library opens (/content-drafts/ hubspot-status) and once a day, as Wix's are. - Send to CMS, the bulk send and the Library know HubSpot; publish and take down stay Webflow, WordPress and Wix's. - Help: content/send-to-cms, content/connect-a-cms and settings/hubspot. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…he pipeline branch's Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
Brings in upstream/main through ansvisor#2265's branch (the Slack PRs). schema.sql is rebuilt with 00510, 00515 and 00522. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #2265 (HubSpot connection). Merge after #2265. This PR's own commits are 1d09202 and 7fb1316, plus a merge of
main.HubSpot, part 4 of #2140: Send to CMS can put a page on the brand's HubSpot blog as a draft post. The owner asked for blog posts first; site and landing pages come in a later PR.
What a person sees:
contentscope (a sign-in made without it), the card says "HubSpot didn't give Ansvisor access to its blogs…", with Connect again.How it works:
supabase/schema.sqlrebuilt). 00521 stays reserved for contact marking.content_draft_deliveries.targetacceptshubspot.target_collectionholds the blog's id andexternal_idthe post's.reserve_content_deliveriesis re-created as in 00372, with HubSpot among the CMSs a page can't be sent to twice at once. It is service-role only.lib/cms/hubspot-blog.js, through the HubSpot sign-in's Composio proxy:GET /cms/v3/blog-settings/settings;POST /cms/v3/blogs/posts, andPATCH /cms/v3/blogs/posts/{id}/draftfor later sends;headHtml) and the body keeps its images.lib/cms/hubspot-delivery.js:contentscope stops a batch, with its own message. Nothing is published.content-delivery.jsNATIVE.hubspot: a page goes only when all of these hold: HubSpot set up, connected, the brand's plan hascrm_integrations, consent to send pages, and a blog picked.GET /api/hubspot/brands/:brandId/blogsandPUT /api/hubspot/brands/:brandId/blog: admins and managers on the plan, who reach the sign-in's brands, with consent to send pages;POST /api/content-drafts/hubspot-status: any member, a brand at most every two minutes;write-roles.test.js's open list;runDailyTracking.cms-target.tsx,send-to-cms-dialog.tsx, the Library's bulk dialog, table and status refresh,cms-send-client.ts,cms-names.ts,cms-status.ts;hubspot-client.tsgains the blog calls;web/messages/en.json.push_cms_draftstay Webflow, WordPress and Wix's (and Framer's for drafts).content/send-to-cms,content/connect-a-cmsandsettings/hubspotdescribe HubSpot. The two content articles are approved, soapproved-articles.jsonwas regenerated.Merging with #2266: this branch starts from #2265. A few files also change in #2266: the HubSpot card,
hubspot-client.ts,lib/hubspot/connection.js,routes/hubspot.js,server.js,en.jsonand the demo guard. I placed this branch's edits away from #2266's in those files, so both should merge without conflicts.Live test with Gökhan:
lib/hubspot/__fixtures__/blog-*.json) follow HubSpot's API reference./cms/v3/blog-settings/settings) and the post states (PUBLISHED,PUBLISHED_OR_SCHEDULED) need checking on a test portal. HubSpot blogs need Content Hub.Related issue
Part of #2140
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
cd server && npx vitest run src/lib/cms/hubspot-blog.test.js src/lib/content-delivery-hubspot.test.js src/routes/hubspot.test.js src/routes/write-roles.test.js src/middleware/demo-brand.test.jscd web && yarn vitest run src/components/settings/hubspot-card.test.tsx src/components/content/send-to-cms-dialog.test.tsx src/lib/hubspot-client.test.ts src/lib/help00522_cms_hubspot_blog.sqlon a dev database.contentscope, the card asks to connect again.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/) — 0 errors; 9 warnings, all in files this PR doesn't touchyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)help/(or no user-visible change) — see help/README.mdChecks run (on 1d09202; 7fb1316 only reorders a test's mocks, and that test was run again on it):
npm run format:check,npm run lint: pass.npm test: 452 files, 6213 passed, 4 skipped.yarn format:check,yarn lint(0 errors),yarn typecheck: pass.yarn test: 1,064 files, 11,660 passed, 1 skipped.hubspot-card.test.tsxwas run again on 7fb1316: 16 passed.yarn build(CI's placeholder env): pass.bash supabase/build-schema.sh:schema.sqlis up to date in this commit.After merging
main(the Slack PRs, through #2265's branch):schema.sqlwas rebuilt with 00522, the HubSpot, Send to CMS and Help tests pass again, and the branch merges cleanly into currentmain.Generated by Claude Code