> ## Documentation Index
> Fetch the complete documentation index at: https://www.voiceflow.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Website lead generation

> Build a website sales assistant for fictional Northstar Supply. It answers demo questions, confirms a visitor’s contact details and creates a HubSpot contact when they…

Build a website sales assistant for fictional Northstar Supply. It answers demo questions, confirms a visitor’s contact details and creates a HubSpot contact when they request follow-up. The visitor’s need remains in the conversation; this example saves first name, last name and email to HubSpot.

## Before you begin

- Permission to create a Chat project and connect HubSpot.
- A HubSpot test account authorized to create contacts and an email address you control for the requester.
- A staging website where you can install the generated widget code.

**Warning:** Create contact writes to the connected HubSpot account. Add a separate draft connection for sandbox tests if needed; otherwise draft conversations use the published connection. Another confirmed request can create another write or return a provider duplicate error.

## Build the lead-capture experience

### 1. Create the sales assistant

Create a **Chat** project named **Northstar Sales**, choose **Start from scratch** and keep **Main** selected.

### 2. Import the demo information

In **Knowledge base → Add data source → Plain text**, import the following practice information:

#### Demo information

```text
Northstar Sales demo

Northstar demonstrates retail-support assistants for customer chat, phone support and staff assistance. A follow-up request lets the team contact the visitor; it does not book a meeting. No pricing, implementation deadline or response-time commitment is included.
```

Wait for processing to finish, return to **Agent** and enable **Knowledge base** under **System tools**.

### 3. Define the conversation

Set **Global prompt** to the following role and boundaries:

#### Sales role

```markdown
# Role
Help website visitors decide whether a Northstar retail-support demo is relevant. Collect contact details only when they request a follow-up.

# Boundaries
Use the approved Knowledge base. Do not invent facts or claim to complete an unavailable action.
```

In **Instructions**, enter:

#### Lead-capture instructions

```markdown
Ask what the visitor wants to improve: customer chat, phone support or staff assistance. Use the Knowledge base to explain the demo.

If they want a follow-up, collect first name, last name and email. Summarize the request and ask permission to send the details.

Only after confirmation, use Create contact. Confirm submission only when the tool succeeds. Do not promise a booked meeting or an automated follow-up email. If they decline, do not create a contact.
```

Northstar Sales instructions for contact confirmation and follow-up — Ask permission before sending a visitor’s details to the sales team.

### 4. Connect HubSpot

Open **Integrations → HubSpot → Connect** and complete the account authorization. Check **Published connection** and **Add draft connection** before running a write. See [HubSpot setup](/docs/documentation/build/tools/hubspot-tool).

### 5. Attach Create contact

Return to **Agent**, click **+** beside **Global tools**, choose **HubSpot → Create contact** and open the attached tool. Set **Trigger** to “Create a HubSpot contact only after the visitor confirms their details and requests follow-up.”

The required fields are `firstname`, `lastname` and `email`. Keep their defaults empty so the conversation supplies each visitor’s details. Leave the optional fields off for this example; do not label the contact as qualified in HubSpot unless you have configured that separate property or action.

HubSpot Create contact attached with its required input fields — Attach the native HubSpot action and collect its required contact details.

### 6. Test confirmation, refusal and the saved contact

Click **Run** and send “I want a demo for our store’s customer chat. I’m Maya Chen, maya@cedarmarket.example.” Use your own controlled email when executing the tool.

The assistant should explain that it will send those details and ask permission. At this point, verify that no contact was created.

Reply “Yes, send them.” Open **Debugger** in Run and select the **Create contact** log to check the completed tool result. It should contain the submitted name and email and the provider’s contact ID.

A confirmed demo request creates a HubSpot contact in the native Run conversation — After confirmation, the simulated Create contact action returns the submitted contact.

Native Run debugger showing the confirmed Create contact tool inputs and returned record — Inspect the simulated tool input and returned record before verifying the real provider account.

Open HubSpot and search for the exact test email. Verify **First name**, **Last name** and **Email** against the tool input, then compare the record’s ID with the returned contact ID. Open the matching **Transcripts** conversation and check the visitor’s request, confirmation and tool result. The simulated record above illustrates the expected result; verify the real write in your connected test account.

Start a fresh Run and decline submission. No contact should be created for that request. Test an incomplete email too: the assistant should ask for a usable address rather than claiming success.

### 7. Launch on the website

Replace the practice business details with approved information. Test the final draft, click **Publish** and confirm the Main release. In **Widget → Installation**, copy the generated snippet into your staging website before `</body>` and publish the website change.

Use the generated [client key](/docs/api-reference/authentication#client-keys), when provided. Never replace it with a personal or service key. If a legacy installation asks to make API access public, review that change before confirming.

Start a fresh website conversation. Submit a request with a second controlled email, then verify the actual HubSpot contact and matching Transcript before making the assistant available to visitors.

## Verify the result

A website visitor can ask about the demo, review their contact details and explicitly request follow-up. HubSpot contains the submitted contact with the correct email, while Transcripts preserves the conversation and interest. 

### HubSpot did not save the contact

Check the connected account, required fields and provider result.

Inspect the tool result for authorization, validation or duplicate-contact errors. Check the test account and the exact submitted email before retrying. Correct the connection or missing field, then run a fresh test; do not treat a conversational “submitted” message as proof of a CRM record.
