Repository navigation
feat(integrations): connect HubSpot per brand, with consent and the Ansvisor property group - #2265
Merged
Merged
Conversation
…nsvisor property group HubSpot, part 1 of ansvisor#2140: Settings › Integrations gets a CRM group with a HubSpot card for the active brand. - Growth and above: a new plan feature, crm_integrations (Growth, Enterprise and self-host, owner 2026-11-09). A connection kept past a downgrade is paused; disconnecting is open on every plan. - Per brand, in the brand access pool (00470): a HubSpot sign-in is an integration_accounts row (provider 'hubspot') the brand uses through brand_integrations, so a brand can use the HubSpot account another brand uses. No migration. - Consent before any write: the person ticks what Ansvisor may do (mark AI-sourced contacts, send pages as drafts) before HubSpot's sign-in. It is kept per brand in brand_integrations.settings, with who allowed it and when, and can be turned off on the card. - With consent to mark contacts, the "Ansvisor" property group and its six contact properties are made right after the sign-in (safe to run again; the AI source dropdown follows the AI source list). - /api/hubspot/brands/:brandId: read, connect, activate, use, settings, setup (Try again) and disconnect, for admins and managers who can access the brand; the demo brand connects nothing. - Composio: proxyRequest takes a method and a JSON body; HubSpot's sign-in has its own auth config (COMPOSIO_HUBSPOT_AUTH_CONFIG_ID). Without it the card says HubSpot isn't set up. - The sign-in reach helpers move from routes/integrations.js to lib/brand-integration-reach.js, shared with the HubSpot routes. - Help: settings/hubspot (approved: false). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…l it names HubSpot The Growth card's extras mirror www.ansvisor.com/pricing, which doesn't list HubSpot yet (the owner adds it there first). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
…nect # Conflicts: # docs/self-host/env-variables.mdx # server/.env.example # server/src/config/plans.js # server/src/lib/composio.js # server/src/lib/composio.test.js # server/src/middleware/subscription.js # server/src/middleware/subscription.test.js # web/src/config/plans.ts
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
9 of 13 tasks
…nect The Slack PRs (ansvisor#2263, ansvisor#2264) added a Team and alerts group where this branch adds the CRM group: both groups are kept, Slack's first, with both strings and both tests. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk
pushed a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Nov 10, 2026
Brings in upstream/main through ansvisor#2265's branch (the Slack PRs). schema.sql is rebuilt with 00510, 00515 and 00520. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
cihan-gyk
pushed a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Nov 10, 2026
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
9 of 13 tasks
9 of 13 tasks
gkhngyk
pushed a commit
that referenced
this pull request
Nov 10, 2026
* feat(content): send pages to the HubSpot blog as draft posts HubSpot, part 4 of #2140 (stacked on #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 * test(content): keep the HubSpot card test's client mocks apart from the pipeline branch's Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9 --------- Co-authored-by: Claude <[email protected]>
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
HubSpot, part 1 of #2140, as the owner approved it on 2026-11-10: the plan, and the mockup's Settings card, connect dialog and disconnect dialog. Settings › Integrations gets a new CRM group with a HubSpot card for the active brand.
What a person sees
How it works
crm_integrationsinweb/src/config/plans.tsandserver/src/config/plans.js, on Growth, Enterprise and self-host. The billing plan cards don't list HubSpot yet. They mirror the pricing page, so the line goes in once the owner adds HubSpot there.integration_accountsrow (providerhubspot) that the brand uses throughbrand_integrations.startBrandAccount,activateBrandAccount,useAccountForBrandandremoveBrandAccount.brand_integrations.settingsas{ contacts, pages, by, at }. The settings also keep the HubSpot account (Hub ID, currency, time zone, address) and the property setup (version, AI source list version, or the refusal's code).lib/hubspot/properties.js,lib/hubspot/setup.js):ansvisorwithansvisor_ai_source(a dropdown of the AI source list),ansvisor_ai_landing_page,ansvisor_ai_first_visit_at,ansvisor_ai_converted_at,ansvisor_brand, and the hiddenansvisor_brand_id;/api/hubspot/brands/:brandId:GETreads it, for any member who can access the brand.POST /connect,/activate,/useand/setup, andPUT /settings, are for admins and managers who can access the brand. They needcrm_integrations(requireFeature).DELETEis open on every plan (COST_STOPPING).DEMO_GUARDED).proxyRequest, which has taken amethodand a JSONbodysince feat(slack): connect a Slack workspace per brand and pick its channel (API) #2259.COMPOSIO_HUBSPOT_AUTH_CONFIG_ID(isHubspotConfigured, andlinkHubspoton the sharedlinkAccount). It isn't inPROVIDERS, because those are workspace-wide sign-ins.lib/hubspot/client.js), which every HubSpot call goes through:api.hubapi.comand waits out 429s;auth,scopes,forbidden,conflict…);assertSignInReachandreachableBrandIdsmove fromroutes/integrations.jstolib/brand-integration-reach.js, shared with the HubSpot routes. Google's behaviour is unchanged, and its tests pass.integrations-section.tsx: one import and one new group at the end, so a line elsewhere (P-7a) or another group (Slack's "Team and alerts", feat(settings): post a brand's Daily Pulse to Slack from Settings › Integrations #2264) merges cleanly.upstream/main(93184ca: Slack feat(slack): connect a Slack workspace per brand and pick its channel (API) #2259, MCP OAuth feat(mcp): give every tool all three hints, with the reason for each #2260–feat(mcp): OAuth discovery, client registration, token and revoke endpoints #2262), keeping both sides:crm_integrations;composio.js: main'sproxyRequest, pluslinkHubspotnext to Slack's connection;COST_STOPPING: both disconnects, so the test expects 12;.env.exampleand the env docs: both entries.server/.env.exampleanddocs/self-host/env-variables.mdxdocumentCOMPOSIO_HUBSPOT_AUTH_CONFIG_IDand the scopes.help/settings/hubspot.md(plan: growth,approved: false).Differences from the mockup
Live test with Gökhan. There is no HubSpot portal here, so the HubSpot answers in the tests (
server/src/lib/hubspot/__fixtures__) follow HubSpot's API reference, with ids replaced. Gökhan should:COMPOSIO_HUBSPOT_AUTH_CONFIG_IDon staging;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/hubspot src/routes/hubspot.test.js src/lib/composio.test.js src/middleware src/routes/write-roles.test.js src/routes/integrations-*.test.jscd web && yarn vitest run src/components/settings/hubspot-card.test.tsx src/components/settings/integrations-section.test.tsx src/lib/hubspot-client.test.tsCOMPOSIO_API_KEYandCOMPOSIO_HUBSPOT_AUTH_CONFIG_IDset and a Growth workspace: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 76767ac and ee41cbe):
npm run format:checkandnpm run lintpass.npm test: 447 files, 6124 passed, 4 skipped.yarn format:check,yarn lint(0 errors) andyarn typecheckpass.yarn test: 1,058 files, 11,527 passed, 1 skipped.plan-switcher.test.tsx, which checks the plan cards against the pricing page. A "HubSpot integration" line caused them.plan-switcher.test.tsxandchoose-plan-dialog.test.tsxnow pass (70 tests).yarn build(CI's placeholder env) passes.After the merge with
upstream/main(93184ca): the stacked AI-sourced pipeline branch, which contains this one, re-ran everything:This branch merges cleanly into current
main.Generated by Claude Code