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

# HubSpot

## Connection <a href="#connect" id="connect"></a>

When you're setting up your first workflow with HubSpot, you'll need to create a [connection](https://docs.getmesa.com/going-further/credentials). Click Connect with HubSpot to start the process.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FqjnZIzkG2hNYnKMLBJ8r%2Fconnect-with-hubspot.png?alt=media&amp;token=3a86a30e-2fb1-4546-be5b-aa8e7a49db36" alt="Screenshot of a MESA workflow HubSpot step connection panel. Spotlight the Connect with HubSpot button."><figcaption></figcaption></figure>

If you are not already logged in, you will be asked to log in and select the HubSpot account that you want to connect.

{% hint style="info" %}
You will need to be a Super User to connect MESA with HubSpot. [Learn more](#requirements)
{% endhint %}

## Configure

Click the Retrieve Fields button to pull in the current fields associated with your HubSpot action.

If you ever update your fields in HubSpot, you will need to click the Retrieve Fields button to pull in the latest changes.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FnaVY9ovnI8YLcr4x2sTi%2Fretrieve-fields-before.png?alt=media&amp;token=e329ea7e-3b5a-478e-a105-cae5cf9b9c88" alt="Screenshot of a MESA HubSpot action step before fields are pulled in. Spotlight the Retrieve Fields button."><figcaption></figcaption></figure>

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FGtD33SVUn84bQgJVMWy5%2Fretrieve-fields-after.png?alt=media&amp;token=80b97c4e-f109-4142-8747-55ad31ef749a" alt="Screenshot of a MESA HubSpot action step after clicking Retrieve Fields, showing the HubSpot fields pulled in. Spotlight the retrieved fields list."><figcaption><p>Example of fields that display from HubSpot</p></figcaption></figure>

### Finding Contact, Deals, and Companies <a href="#configuring" id="configuring"></a>

Use the "Search" actions for the object you want to retrieve: Search for Contact, Search for Deal, Search for Company

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2F4uY35dgx1woc1x0tULI5%2Fsearch-for-contact.png?alt=media&amp;token=fd7a0380-9bc1-49bf-aa54-7888ebe97e5c" alt="Screenshot of the MESA HubSpot action selector. Spotlight the Search for Contact action."><figcaption></figcaption></figure>

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FczRcynSZpqWGukAeSpcA%2Fsearch-for-deal.png?alt=media&amp;token=77028bfd-20cc-4d31-a914-fda827e4f78f" alt="Screenshot of the MESA HubSpot action selector. Spotlight the Search for Deal action."><figcaption></figcaption></figure>

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2Fx97mDPkxPtgqnXQpOG3F%2Fsearch-for-company.png?alt=media&amp;token=bce5e70f-04cc-4d72-b91e-1d16b41f3395" alt="Screenshot of the MESA HubSpot action selector. Spotlight the Search for Company action."><figcaption></figcaption></figure>

It is recommended to set up these fields while using these actions:

* **Limit**: Set the number of results to return from this action. If you would only like 1 result to return, please set it to 1.
* **After**: Set to 0.
* **Query**: Add text and use it if you want to run a general query.
* **Filter Groups**: Use this instead of Query to run a specific query. Hit Add Set and fill in the Property Name, Operator, and Value fields.

Add "Retrieve" actions to retrieve the variables from your search results.

### Selecting Pipelines <a href="#search-for-contacts" id="search-for-contacts"></a>

Once you have [connected HubSpot with MESA](https://docs.getmesa.com/apps/hubspot#connect), click the More options button and select the Pipeline field to add a value.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FXQBJNd4VWtRrE6WHlg20%2Fcreate-deal-more-options.png?alt=media&amp;token=51deafca-1e30-4db8-a272-d7720e3177cd" alt="Screenshot of a MESA HubSpot Create Deal step. Spotlight the More options button used to add the Pipeline field."><figcaption></figcaption></figure>

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FdeMUmE88zZ3mAl3s22q0%2Fsales-pipeline.png?alt=media&amp;token=26f67a07-9502-439e-b307-fadf3d43a412" alt="Screenshot of a MESA HubSpot Create Deal step with More options expanded. Spotlight the Pipeline field."><figcaption></figcaption></figure>

Now that you have a Pipeline specified, select Deal Stage from More options. MESA will only retrieve Deal Stages linked to that Pipeline.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FURbJmCg2LSWIYKQu85vm%2Fdeal-stage.png?alt=media&amp;token=836ecb88-75fe-49c7-a88e-e169f9389c24" alt="Screenshot of a MESA HubSpot Create Deal step with a Pipeline specified. Spotlight the Deal Stage field under More options."><figcaption></figcaption></figure>

## Technical Notes

### Requirements

* **Super User permissions:** Requires Super User permissions on your HubSpot account in order to connect MESA with HubSpot
* Your HubSpot plan must have access to the following scopes.
  * crm.objects.companies.read
  * crm.objects.companies.write
  * crm.objects.contacts.read
  * crm.objects.contacts.write
  * crm.objects.deals.read
  * crm.objects.deals.write
  * crm.objects.owners.read
  * e-commerce
  * oauth

If you have any issues with creating a connection and authenticating with HubSpot, we recommend reaching out to the HubSpot support team here: [help.hubspot.com](https://help.hubspot.com/)

{% hint style="info" %}
View HubSpot templates and tutorials [here](https://www.getmesa.com/apps/hubspot/integrate)!
{% endhint %}


---

# 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.getmesa.com/connect/hubspot.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.
