← Insights
Explainer

How a HubSpot API integration works

Josh BrownDeveloper & Project Manager
Published Last updated 3 min read

Short answer

A HubSpot API integration is code that reads records from one system and writes them to HubSpot, or the reverse. Each run is started by a webhook (the other system sends an event) or by polling (the integration checks on a schedule). It runs on a server and logs every run so failures are visible.

Most integration problems I'm asked to fix aren't bugs. They're design decisions nobody wrote down. So here's how a well built integration is put together, part by part.

The five parts

  1. Trigger. Something starts a run: a webhook arriving, or a schedule firing.
  2. Fetch. The integration reads new or changed records from the source system's API.
  3. Transform. Data is converted into HubSpot's shape. Dates, currencies and dropdown values are reformatted, and each record is matched to an existing one where possible.
  4. Write. Records are created or updated in HubSpot and associated with the right contacts, companies or deals.
  5. Log. Every run is recorded: what changed, what failed, why.

Most of the engineering goes into step 3. That's where your business rules live: how a customer is matched, what an order becomes in HubSpot, what happens when a field is missing.

Webhooks or polling

A webhook is the other system telling you something happened, as it happens. A polling integration asks the other system "anything new?" on a schedule.

WebhooksPolling
SpeedNear instantAs often as the schedule
RequirementSource must support themWorks with almost any API
Cost to runLow, work only happens on eventsEvery check costs compute, even when nothing changed
Failure modeMissed events need a catch up jobSimple to retry

We had a client platform that checked for new data every 15 minutes. It worked, but every check cost compute whether anything had changed or not. Moving it to webhooks means it only does work when there's something to do. Polling is still the right answer when the source has no webhooks or the data doesn't need to be fresh, for example orders synced throughout the day.

Where it runs

On a server. We can host and monitor it for a monthly fee based on traffic and storage, or hand hosting over to your team. Integrations we host run on Cloudflare's network. We use batching and concurrency so transfers cost as little as possible, and we keep only what the integration needs to run: sync status, record IDs and logs.

How it's tested

Three stages, in order:

  1. Our own test HubSpot account.
  2. A sandbox in your account with dummy data.
  3. Live data.

Releases go through automated tests and dry runs. A dry run shows exactly what would change without writing anything, which catches mapping errors before they touch real records.

What happens when it fails

It will, eventually. APIs go down, credentials expire, someone renames a field. A good integration retries safely (running the same update twice shouldn't create two records), logs the error and alerts someone. For integrations we host, that someone is us. One client gets a daily summary of syncs run, failures and orders matched.

FAQ

FAQs

Josh Brown

Josh Brown

Developer & Project Manager

Josh builds Incepty's integrations and custom APIs in Python and Go, and manages projects from scope to go-live.