# 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&#x26;token=3a86a30e-2fb1-4546-be5b-aa8e7a49db36" alt=""><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&#x26;token=e329ea7e-3b5a-478e-a105-cae5cf9b9c88" alt=""><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&#x26;token=80b97c4e-f109-4142-8747-55ad31ef749a" alt=""><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&#x26;token=fd7a0380-9bc1-49bf-aa54-7888ebe97e5c" alt=""><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&#x26;token=77028bfd-20cc-4d31-a914-fda827e4f78f" alt=""><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&#x26;token=bce5e70f-04cc-4d72-b91e-1d16b41f3395" alt=""><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&#x26;token=51deafca-1e30-4db8-a272-d7720e3177cd" alt=""><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&#x26;token=26f67a07-9502-439e-b307-fadf3d43a412" alt=""><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&#x26;token=836ecb88-75fe-49c7-a88e-e169f9389c24" alt=""><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 %}
