Skip to content
Solutions Blueprint

Syncing HubSpot and AlayaCare Without Storing Health Data

Hero featured image

A national privacy law barred an aged care provider from storing health information inside its CRM, but sales staff needed it captured the moment a prospect was ready. We built a hosted middleware form that forks each submission: sensitive fields go to AlayaCare and a local database, non-sensitive fields go to HubSpot, linked by ID.

Executive Summary

context-header-icon

Context

A not-for-profit aged care, home care and retirement living provider ran sales in HubSpot but managed clinical records in AlayaCare. Every prospect needed a CRM record sales could work and a compliant case file care managers could act on.

what-we-built-header-icon

What We Built

We built a hosted intake form that forks each submission at capture: health and care-plan fields go straight to AlayaCare, name and lifecycle fields go to HubSpot, and a PDF attaches to the AlayaCare record for staff without CRM access.

tech-stack-header-icon

Tech Stack

  • PHP 8
  • MySQL
  • HubSpot CRM
  • AlayaCare External API
  • AlayaCare External Files API

Not a fit if your organisation doesn't have an internal team capable of hosting a custom application, since this hands sensitive-data handling to a script your IT staff run, not a vendor connector. It also assumes the receiving system exposes a real API for records and attachments.

the-challenge-header-icon

The Challenge

Sales reps worked every prospect inside HubSpot, but home care enquiries often included data that the CRM couldn't safely store: health conditions, hazards and care-plan detail protected under Australia's Privacy Act 1988. Native webhooks and custom code needed a higher hub tier the provider lacked, so the fork logic could not run inside the CRM.

AlayaCare exposed an external API and a files API, but the files API didn't have a notes field. And because the platform didn't retain history, later resubmissions were overwriting data that was already there.

our-approach-header-icon

Our Approach

We considered four hosting options: a vendor-run connector, HubSpot custom code on a higher hub tier, a Google Forms and Zapier bridge, and a standalone script on the provider's own server. The higher-tier option cost too much in licence fees, and Google Forms and Zapier were dismissed once IT confirmed it could host a custom application. The standalone script won: a PHP 8 and MySQL middleware layer that gets triggered when a rep marks a prospect ready for a first face-to-face meeting.

Sensitive fields write to the local MySQL table and to AlayaCare's external API; non-sensitive demographics reach both systems. The HubSpot contact ID stores on the AlayaCare record as a reference field, and AlayaCare's internal ID writes back, so that records get deduplicated on resubmission.

Because AlayaCare's files API has no notes field, every submission renders a PDF for the care managers who don't have HubSpot seats. Punch testing found the trade-off: AlayaCare keeps no field history, so a blank field on resubmission overwrites a correct value.

impact-header-icon

Impact

check-icon

Sensitive health data reaches the care team without touching the CRM

The intake fork keeps health conditions, hazards and care-plan detail on the provider's own server and inside AlayaCare, so the CRM never stores regulated health information that it isn't licensed to hold. Sales reps capture everything in one form, because the split happens automatically.

check-icon

Care managers read the full intake without a HubSpot login

A PDF of every submitted field attaches to the AlayaCare record the moment the form is sent, so care managers who don't have HubSpot seats get the same detail a rep captured, not a re-typed summary. That removed a manual handoff and its errors.

check-icon

One entry point on the HubSpot contact record itself

The intake form opens from a custom card on the HubSpot contact record, so a rep working a deal never leaves the CRM to start the compliance-safe capture. That entry point carries the contact's HubSpot ID into the form, populating the AlayaCare join key.

check-icon

An architecture the provider extended when funding rules changed

When a funding reform changed which fields intake had to capture, the provider extended the same form and fork rather than starting over, adding classification and approval fields. The open defect from punch testing, where a blank field overwrote a value on resubmission, has been flagged and is scheduled to be fixed.

Technical Blueprint
1

The intake form splits on submission: health, hazard and care-plan fields write only to the provider's MySQL table and to AlayaCare, while contact and lifecycle fields write to both AlayaCare and HubSpot. This logical partitioning keeps sensitive fields out of the CRM.

2

The HubSpot contact ID writes to AlayaCare as a reference field on creation, and AlayaCare's internal ID writes back once the record exists. A later submission checks that stored ID, so that the existing record gets updated instead of a duplicate being created.

3

AlayaCare's files API accepts attachments but doesn't expose an authorised notes field, so the custom API layer renders the form to a PDF and attaches it through that API. Care managers open the PDF instead of a notes tab the platform doesn't have.

4

A custom card on the HubSpot contact record is the only way a rep opens the intake form, keeping the compliance-safe path the fastest one. The card carries the contact's HubSpot ID into the form, populating the AlayaCare join key.

Diagram of a HubSpot contact opening a custom intake form that sends sensitive data to AlayaCare and non-sensitive data to both AlayaCare and HubSpot.

A rep marks a prospect ready for a first face-to-face meeting and opens the intake form from a custom card on the HubSpot contact record. The form, a PHP 8 and MySQL application on the provider's own server, decides where each field goes: health, hazard and care-plan fields go only to the local MySQL table and AlayaCare's external API, while name, contact and lifecycle fields also go to HubSpot. It then renders the full submission as a PDF and attaches it to the AlayaCare case record through the files API. AlayaCare returns its internal ID to the HubSpot contact, so a later submission updates the record instead of duplicating it.

FAQ

How does the integration keep health information out of HubSpot?

The intake form decides what each field is before anything is sent. Health, hazard and care-plan fields write only to the provider's database and to AlayaCare; everything else also writes to HubSpot. HubSpot never receives the regulated fields.

What happens when a care manager has no HubSpot access?

Care managers don't need HubSpot access, because every submission generates a PDF and attaches it to the AlayaCare record through AlayaCare's files API. That gives them the same detail a rep captured.

Continue reading

Hero featured image
209049082793

Luxury yacht manufacturer: CRM governance, 16.9% MQL-to-SQL

Hero featured image
209049052783

$500M+ telecom provider: one CPQ for MSP and ISP catalogs

Hero featured image
209049052785

Health insurance web broker: NPN hierarchies in HubSpot

Hero featured image
209049052787

$50M+ telehealth provider: HIPAA-compliant clinical ERP sync

Hero featured image
209049052787

$50M+ telehealth provider: attribution recovered via API fix

Hero featured image
209049052786

Environmental IoT provider: partner directory routes leads

Hero featured image
209053190299

$100M+ real estate tech firm: automated KYC gates and SSO

Hero featured image
209049052785

$1B+ financial data provider: Pardot and Eloqua into HubSpot

Hero featured image
209053177394

Global abrasives producer: 40+ sites from Kentico to HubSpot

Hero featured image
209049082792

Global abrasives producer: 13 dashboards consolidated to one

Hero featured image
209049052787

Medical device maker: five regional domains into one CMS

Hero featured image
209049052787

Medical device maker: automated clinical triage in HubSpot

Hero featured image
209049052787

Multi-site dental group: lifecycle logic rebuilt, true ROI

Hero featured image
209049052787

Multi-site dental group: assessment tool for lead quality

Hero featured image
209049082794

K-12 Catholic diocese: 80 schools on one HubDB lead system

Hero featured image
209049052787

Cell therapy biotech: HubSpot CMS migration, 92 speed score

Hero featured image
209049052787

Cell therapy biotech: 40-hour enablement and lead routing

Hero featured image
209049082794

Wellness training provider: 925k records moved to HubSpot

Hero featured image
209049052786

Cybersecurity trainer: 595 workflows audited for debt

Hero featured image
209049052785

Tier 1 auto F&I provider: 14,000% CTA lift, 21% PVR lift

Hero featured image
209049052785

Mexican retail bank: Infobip to Intercom via Apache NiFi

Hero featured image
209049052786

Global streaming platform: ETL middleware feeds Customer.io

Hero featured image
209049052786

Global streaming platform: usage milestones trigger upsell

Hero featured image
209049052786

Cloud and edge provider: Intercom to Salesforce via MuleSoft

Hero featured image
209049052785

$50M+ FinTech SaaS provider: advisor onboarding 30% faster

Hero featured image
209049082792

Mining autonomy provider: global consent and data governance

Hero featured image
209053177394

Industrial IoT division: compliant list purge, leads 3 to 62

Hero featured image
209053177394

Industrial IoT division: 25,000 records merged, one portal

Hero featured image
209049052786

Logistics SaaS portfolio: Salesforce sync rebuilt on Tray.io

Hero featured image
209049052786

Logistics SaaS portfolio: brands consolidated into HubSpot

footerCTA footerCTA-mobile
Spice up your inbox
Sign up for our newsletter
Don't worry - we only average, like, two emojis per subject line.