⌘I

Create leads and contacts in Hubspot using the Formspree CLI

Updated July 14, 2023 ·
goldplatinumpluginshubspotformspree-cli
Also available in:

Adding the hubspot action in the formspree.json file has the same effect as adding the Hubspot plugin in the Formspree dashboard. See the Hubspot plugin help article to know about leadStatus, lifeCycleStage and for more information.

Creating Private App

Hubspot deprecated the account API Key. For now, you should create a Private App instead and select specific scopes for the access token. Form more informations check here.

  • In your HubSpot account, click the settings icon in the main navigation bar.
  • In the left sidebar menu, navigate to Integrations>Private Apps.
  • Click Create private app.
  • Configure your app details
  • Click on the scopes tab and check
    • crm.objects.contacts.read (CRM->Contacts->Read)
    • crm.objects.contacts.write (CRM->Contacts->Read)
    • crm.objects.companies.read (CRM->Companies->Read)
    • crm.objects.companies.write (CRM->Companies->Write)
  • In the dialog box, review the info about your app’s access token, then click Continue creating.

To start making API calls, navigate to the details page of your app.

On the Access token card, click Show token to reveal your access token. Click Copy to copy the token to your clipboard and paste it in your Fomrpsree CLI deployment file as accessToken attribute.

Formspree.json configuration

KeyTypeDescription
appStringMust be hubspot
typeStringMust be createContact
apiKeyStringYour API key (must be a $env variable reference, required) (deprecated)
accessTokenStringYour Private APP access token (must be a $env variable reference, required)
leadStatusStringOptional field. Must be one of NEW, OPEN, IN_PROGRESS, OPEN_DEAL, UNQUALIFIED, ATTEMPTED_TO_CONTACT, CONNECTED, or BAD_TIMING. Default is NEW.
lifeCycleStageStringOptional field. Must be one of subscriber, lead, marketingqualifiedlead, salesqualifiedlead, opportunity, customer, or other. Default is empty.
overwriteContactBooleanOptional field. If true, overwrite contact information if the contact email already exists in Hubspot. Default is false

Example

{
  "forms": {
    "registrationForm": {
      "name": "Registration Form",
      "actions": [
        {
          "app": "hubspot",
          "type": "createContact",
          "accessToken": "$accessToken",
          "leadStatus": "NEW",
          "lifeCycleStage": "lead",
          "overwriteContact": true
        }
      ]
    }
  }
}

Validation rules

The create support ticket action adds the following validation rules implicitly:

FieldValidation Rule
emailRequired
emailType is email

Still have questions? or .