Check drafts in a HubSpot workflow (custom code)
If a HubSpot workflow writes or sends AI copy, add a Custom code action before the send step. Custom code actions need a HubSpot plan that includes them.- In the workflow, add Custom code, language Node.js.
- Under Secrets, add
DATAVIBE_API_KEY(create it at app.datavibe.cc/security/api-keys). - Under Properties to include in code, add
email,firstname,company,jobtitle, and the property that holds the AI draft (this example usesai_email_bodyandai_email_subject). - Paste this code and define the three output fields (
dv_status,dv_action_id,dv_rules) as strings.
- Add an If/then branch on
dv_status:APPROVED→ continue to the send or enroll action.QUEUED→ stop; a reviewer approves it in DataVibe.- Anything else (
BLOCKED,FAILED,GATE_ERROR) → stop and copydv_rulesto a contact property or task.
Use
event.callbackId (unique per execution) in the idempotency_key so a HubSpot retry of the same
execution returns the original decision instead of creating a second check.Connect (evidence pull)
An admin connects HubSpot once per workspace, in Settings → Integrations. This authorizes read-only access to contact properties:crm.objects.contacts.read crm.schemas.contacts.read
scope and stores an encrypted refresh token. DataVibe never stores your
HubSpot access token.
Pull evidence before a gate call
Fetch a contact’s acquisition/funding/promotion properties and shape them assource_records for the clay_revops_freshness_v1 policy template:
source_records
straight into metadata.source_records on the POST /v1/gate/outbound
call. See Revenue integrity for how DataVibe uses
these records.
Signed inbound intake
To ingest HubSpot activity into DataVibe (for example, workflow-triggered outbound), register a webhook at:X-HubSpot-Signature-v3,
over the timestamp and body, checked against X-HubSpot-Request-Timestamp.
Requests that fail signature verification are rejected before any policy
evaluation.
Blocked contacts are tagged back in HubSpot (
dv_gate_blocked,
dv_gate_action_id) so a BLOCK verdict is visible directly on the contact
record, not only in the DataVibe audit log.