Send leads to HubSpot
Creates or updates a contact with its channel.
Add source properties to contacts
In HubSpot, open your contact properties and select Create property for each row below, as Single-line text on the Contact object. HubSpot fills in the internal name from the label; check that it matches.
VisitorLayer channel visitorlayer_channel VisitorLayer source visitorlayer_source VisitorLayer campaign visitorlayer_campaign VisitorLayer landing page visitorlayer_landing_page Create a private app token
As a super admin, go to DevelopmentLegacy apps, select Create legacy app, and choose Private. Name it VisitorLayer.
On the Scopes tab, select Add new scope, turn on
crm.objects.contacts.write, and select Update. Then select Create app.On the app's Auth tab, select Show token and copy it.
Add the webhook in VisitorLayer
Open your project's Webhooks and select New webhook.
Endpoint URL https://api.hubapi.com/crm/v3/objects/contacts/batch/upsert Event to send Your lead form Header Authorization: Bearer your-token Paste this into the payload. It creates the contact, or updates it when the email already exists.
Payload{ "inputs": [ { "idProperty": "email", "id": "{{form.email}}", "properties": { "email": "{{form.email}}", "firstname": "{{form.name}}", "phone": "{{form.phone}}", "visitorlayer_channel": "{{attribution.channel}}", "visitorlayer_source": "{{attribution.utm_source}}", "visitorlayer_campaign": "{{attribution.utm_campaign}}", "visitorlayer_landing_page": "{{page.landing_path}}" } } ] }Rename each
form.token to match your form's fields, or pick them from Insert field. A field your form does not capture sendsnull.{{attribution.channel}}sends the same channel the Channels page shows for the lead, including your own channel rules.Send a test lead
Save the webhook and select Test webhook. Then submit your form on the live site. The webhook shows Healthy, and the contact appears in HubSpot with VisitorLayer channel filled in.
If a delivery fails
crm.objects.contacts.write scope.