# PingCAP HubSpot Companion

This pack is the tenant-owned source of truth for PingCAP HubSpot companion
metadata.

It owns the HubSpot-to-NexusCRM field mappings and Flow bodies that adapt the
generic `hubspot-crm-connector` pack to this tenant's CRM data model. The
generic connector pack remains in the L1 app-pack distribution repository; this
tenant companion payload does not.

The workflow-action companion flow also owns the current PingCAP eventual-
consistency bridge for HS-07B: if the HubSpot custom action executes before the
contact-created webhook has materialized a Lead, the L1 connector route
auto-fetches the full HubSpot contact by callback `objectId`. The flow creates
a Lead shell from that enriched contact record, hydrates it through the
contact-to-Lead mapping using the same record, and applies a bound owner when
`hubspot_owner_id` resolves uniquely in `HubSpotOwnerBinding__c`. It then
immediately creates or updates the CampaignMember against that shell. The later
inbound webhook converges onto the same Lead row by email / `HubSpot_Id__c`.

The HubSpot workflow action definition should only carry command inputs such as
`campaign_id` and `status`; contact properties are intentionally not duplicated
into action fields because the connector worker owns the source-record hydrate.

Deployment pipelines for PingCAP environments should source this companion pack
from this repository. Do not copy the same pack payload back into the L1
distribution repo, because duplicated pack roots drift and make exp/prod
audits unreliable.

For post-enqueue failure recovery, dead-event inspection, and replay steps, see
`RUNBOOK.md`.
