Send leads to your CRM

Send leads to HubSpot

Creates or updates a contact with its channel.

Unverified10 minSuper admin access to the HubSpot account
  1. 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 channelvisitorlayer_channel
    VisitorLayer sourcevisitorlayer_source
    VisitorLayer campaignvisitorlayer_campaign
    VisitorLayer landing pagevisitorlayer_landing_page
  2. 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.

  3. Add the webhook in VisitorLayer

    Open your project's Webhooks and select New webhook.

    Endpoint URLhttps://api.hubapi.com/crm/v3/objects/contacts/batch/upsert
    Event to sendYour lead form
    HeaderAuthorization: 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 sends null.

    {{attribution.channel}} sends the same channel the Channels page shows for the lead, including your own channel rules.
  4. 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

401The token is wrong or was rotated. Replace the Authorization header value.
403The private app is missing the crm.objects.contacts.write scope.
400A property name in the payload does not exist in HubSpot, or the lead has no email. Check the internal names from step 1.