N
HeadlessCoreHeadless Core
Back to Home

CRM Integration (pro, off by default)

Pushes contact form and newsletter submissions into HubSpot or Mailchimp, extending the existing generic Slack/Discord webhook (headlesscore_contact_webhook_url) rather than replacing it — both can run at once.

Setup

Headless Core → Settings → CRM Integration (requires a valid pro license):

  1. Choose a provider: HubSpot or Mailchimp.
  2. Paste the matching credential.

HubSpot

  • Create a Private App in your HubSpot account with the crm.objects.contacts.write scope.
  • Paste the generated token into HubSpot Private App Token.
  • Contacts are upserted by email (PATCH /crm/v3/objects/contacts/{email}?idProperty=email) — a repeat submission from the same email updates the existing contact rather than creating a duplicate.
  • Contact form submissions also map name to HubSpot's firstname/lastname properties (split on the first space — HubSpot has no single "full name" field).

Mailchimp

  • Get your API key from Mailchimp account settings, and your Audience (List) ID from the audience's settings page.
  • Paste both into their respective fields.
  • Uses the list members endpoint (PUT /lists/{listId}/members/{subscriber_hash}, where the hash is an MD5 of the lowercased email) — same upsert-by-email behavior as HubSpot.

How it works

inc/crm.php's headlesscore_push_to_crm($type, $data) is called from inside both submitContactForm and subscribeNewsletter's mutateAndGetPayload closures (functions.php), right after their existing webhook call. Every request is fire-and-forget (wp_remote_post with 'blocking' => false) — a CRM provider being slow or down never delays the response to the person submitting the form. This matches the existing contact-form webhook's own behavior; no new pattern introduced.

Deferred (not in v1)

  • Other CRMs (Salesforce, Pipedrive, etc.) — only HubSpot and Mailchimp ship built-in. headlesscore_push_to_crm() is a small switch; adding a third provider is a short, self-contained addition if needed.
  • Retry on failure — since calls are non-blocking, a failed push isn't retried or logged anywhere visible in wp-admin today.
  • Custom field mapping beyond name/email — no UI for mapping additional form fields to CRM custom properties.