> For the complete documentation index, see [llms.txt](https://docs.clearout.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clearout.io/integrations/hubspot/hubspot-chatflows.md).

# HubSpot Chatflows

Verify chatbot leads in HubSpot real time.

**Verify chatbot and live chat leads in real time** by connecting Clearout’s Email Verification API to HubSpot Chatflows. This ensures invalid, disposable, or risky emails are caught during the conversation, before they enter your HubSpot CRM.​

You can also watch:

{% embed url="<https://www.youtube.com/watch?embeds_referring_euri=https://clearout.io/&source_ve_path=Mjg2NjY&v=5EnqNy7OjdY>" %}

***

### Integrate Clearout in HubSpot Chatflows  <a href="#k5hl0" id="k5hl0"></a>

Follow these steps for a bot such as **Qualify leads bot** (the same pattern works for other bots)

Open your HubSpot chatflow:

* Go to **Services→ Chatflows**.
* Click **Create chatflow → Website → Rules-based chatbot** and choose a bot (for example,  **Qualify leads bot**).
* Click **Next** to go to the **Build** section, where you can edit the action boxes

The steps given below are for the **Qualify leads bot**:

{% stepper %}
{% step %}
Once 'Qualify leads bot' is selected, click Next to reach the Build section to edit the Action Boxes.
{% endstep %}

{% step %}
Scroll down to the Action box named Get Email and click on the + icon below it to create a new action for email verification.

<div data-with-frame="true"><figure><img src="https://93738666-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEXQQW0hsXyH0YD4ePoxb%2Fuploads%2FB9G54rFgbT2p80w6ZaR6%2FChatflows.png?alt=media&amp;token=56b28830-02ae-47c0-b90c-32a773553558" alt="Select Action Box to create trigger for Email verification in HubSpot Chatflow"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
A new Action window will open. Scroll down to Run a code snippet, give an Action name and delete the existing code.

<div data-with-frame="true"><figure><img src="https://93738666-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEXQQW0hsXyH0YD4ePoxb%2Fuploads%2FTPoNyrifhDRWQdb0QYgz%2FChatflows%20(1).png?alt=media&amp;token=a772618d-51a8-410c-989c-f3d3110ce299" alt="Run a code snippet, give an Action name and delete the existing code"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
Please copy and paste this code.

{% code lineNumbers="true" %}

```javascript
exports.main = async (event) => {
  const email = event.session.parsedResponses.Get_Email.parsedResponse;
  let nextModuleNickname = 'send_to_team_member';
  let botMessage = '';

  try {
    const response = await fetch('https://api.clearout.io/v2/email_verify/instant', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'DEVELOPER_API_KEY', // Enter your generated Developer API Key
      },
      body: JSON.stringify({ email: email, timeout: 30000 }),
    });

    const body = await response.json();

    if (!response.ok || body.status !== 'success') {
      throw new Error('Clearout verification failed');
    }

    if (body.data.safe_to_send !== 'yes') {
      nextModuleNickname = 'Get_Email';
      botMessage = email + ' is not a valid email address. Please enter a valid one.';
    }
  } catch (err) {}

  return {
    botMessage: botMessage,
    nextModuleNickname: nextModuleNickname,
    responseExpected: false,
  };
};


```

{% endcode %}
{% endstep %}

{% step %}
**Edit Row 11** by replacing '**DEVELOPER\_API\_KEY'** with Clearout's API Token and Save.
{% endstep %}

{% step %}
How To Generate a Clearout API Token?

* To generate a Clearout API token, log in to Clearout, then navigate to [Developer **→** API](https://app.clearout.io/developer/api/list).
* Give a name and description to the token and click Create
* Copy the API token and paste it in Row 11 of the code

<div data-with-frame="true"><figure><img src="https://93738666-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEXQQW0hsXyH0YD4ePoxb%2Fuploads%2F0Ebx6R2EmcT4aBImt0vk%2Fimage.png?alt=media&amp;token=6d7129e1-962a-4e53-a328-05285fbd07a2" alt="Generate Clearout Server API Token"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
Go to the Get Email action box and edit the action name to Get\_Email.

> Note: The name should be exactly the same.
> {% endstep %}

{% step %}
In the same Action box, scroll down to Save to HubSpot property. Choose Email from the dropdown. Uncheck the box that says Skip this action if property already exists and Save.

<div data-with-frame="true"><figure><img src="https://93738666-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEXQQW0hsXyH0YD4ePoxb%2Fuploads%2FNY0ET959SLERo582pZqo%2FChatflows%20(2).png?alt=media&amp;token=d7faa49c-f5a7-4a8a-b55e-d3362e434749" alt="Save to HubSpot property. Choose Email from the dropdown. Uncheck the box that says Skip this action if property already exists and Save."><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Your** **HubSpot chatbot with real-time email verification is READY**! Give it a test run by hitting Preview.

Wasn't that quick and easy? The addition of a simple code snippet to your Chatflows can effectively block unwanted junk data from infiltrating your system. Let's make a conscious decision to work exclusively with fresh and valid data, ensuring we don't squander our precious time on irrelevant information.

{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.clearout.io/integrations/hubspot/hubspot-chatflows.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
