PHPackages                             stokoe/forms-to-hubspot-connector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. stokoe/forms-to-hubspot-connector

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

stokoe/forms-to-hubspot-connector
=================================

0.1.0(2mo ago)03PHPPHP ^8.2 || ^8.3

Since Nov 15Pushed 2mo agoCompare

[ Source](https://github.com/Michael-Stokoe/statamic-forms-to-hubspot-connector)[ Packagist](https://packagist.org/packages/stokoe/forms-to-hubspot-connector)[ RSS](/packages/stokoe-forms-to-hubspot-connector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

Forms To HubSpot Connector
==========================

[](#forms-to-hubspot-connector)

**Seamlessly connect your Statamic forms to HubSpot** - Automatically create and update contacts in HubSpot with advanced field mapping and comprehensive error handling.

🔗 Related Connectors
--------------------

[](#-related-connectors)

This connector is part of the **Forms To Wherever** ecosystem. Check out our other connectors:

- **[Forms To Wherever](https://statamic.com/addons/stokoe/forms-to-wherever)** - Base package (required)
- **[Forms To Mailchimp](https://statamic.com/addons/stokoe/forms-to-mailchimp-connector)** - Mailchimp email marketing
- **[Forms To ConvertKit](https://statamic.com/addons/stokoe/forms-to-convertkit-connector)** - ConvertKit email marketing
- **[Forms To ActiveCampaign](https://statamic.com/addons/stokoe/forms-to-activecampaign-connector)** - ActiveCampaign automation
- **[Forms To Salesforce](https://statamic.com/addons/stokoe/forms-to-salesforce-connector)** - Salesforce CRM integration

Features
--------

[](#features)

- **Automatic contact creation/updates** in HubSpot CRM
- **Custom field mapping** to HubSpot contact properties
- **Duplicate handling** - Updates existing contacts by email
- **Comprehensive error handling** with detailed logging
- **Production-ready** with security and reliability built-in

Requirements
------------

[](#requirements)

- [Forms To Wherever](https://statamic.com/addons/stokoe/forms-to-wherever) base addon
- HubSpot account with private app access
- PHP 8.2+
- Statamic 5.0+

Installation
------------

[](#installation)

1. Install the base Forms To Wherever addon:

```
composer require stokoe/forms-to-wherever

```

2. Install this HubSpot connector:

```
composer require stokoe/forms-to-hubspot-connector

```

Configuration
-------------

[](#configuration)

### 1. Create a HubSpot Private App

[](#1-create-a-hubspot-private-app)

1. In HubSpot, go to **Settings → Integrations → Private Apps**
2. Click **Create a private app**
3. Give it a name (e.g., "Statamic Forms Integration")
4. In the **Scopes** tab, select:
    - `crm.objects.contacts.read`
    - `crm.objects.contacts.write`
5. Click **Create app** and copy the access token

### 2. Configure Your Form

[](#2-configure-your-form)

Add the `form_connectors` field to your form blueprint:

```
fields:
  # Your existing form fields...
  -
    handle: connectors
    field:
      type: form_connectors
      display: Form Connectors

```

### 3. Enable HubSpot in Control Panel

[](#3-enable-hubspot-in-control-panel)

1. Edit your form in the Statamic Control Panel
2. Navigate to the "Form Connectors" section
3. Enable the **HubSpot** connector
4. Configure the settings:
    - **Access Token**: Your HubSpot private app access token
    - **Email Field**: Form field containing email (default: `email`)
    - **Create Contact**: Enable to create/update contacts
    - **Field Mapping**: Map form fields to HubSpot properties

Field Mapping
-------------

[](#field-mapping)

Map your form fields to HubSpot contact properties:

Form FieldHubSpot PropertyDescription`first_name``firstname`First name`last_name``lastname`Last name`phone``phone`Phone number`company``company`Company name`website``website`Website URL`job_title``jobtitle`Job title### Custom Properties

[](#custom-properties)

You can create custom properties in HubSpot and map them:

1. In HubSpot: **Settings → Properties → Contact properties**
2. Create your custom property and note the internal name
3. Map your form field to the custom property in the connector settings

Example Form
------------

[](#example-form)

```
# resources/forms/contact.yaml
title: Contact Form
fields:
  -
    handle: email
    field:
      type: email
      display: Email Address
      validate: required|email
  -
    handle: first_name
    field:
      type: text
      display: First Name
      validate: required
  -
    handle: last_name
    field:
      type: text
      display: Last Name
      validate: required
  -
    handle: company
    field:
      type: text
      display: Company
  -
    handle: phone
    field:
      type: text
      display: Phone Number
  -
    handle: connectors
    field:
      type: form_connectors
      display: Form Connectors

```

How It Works
------------

[](#how-it-works)

1. **Contact Creation**: When a form is submitted, the connector attempts to create a new contact
2. **Duplicate Handling**: If a contact with the same email exists (409 error), it searches for and updates the existing contact
3. **Field Mapping**: Maps form fields to HubSpot properties based on your configuration
4. **Error Handling**: Logs all API responses and errors for debugging

Error Handling
--------------

[](#error-handling)

The connector includes comprehensive error handling:

- **Missing access tokens** - Logs warning and skips processing
- **Invalid email addresses** - Validates emails before sending
- **API failures** - Logs detailed error information with context
- **Network timeouts** - 10-second timeout with graceful failure
- **Duplicate contacts** - Automatically updates existing contacts

All errors are logged to your Laravel log files for debugging.

Asynchronous Processing
-----------------------

[](#asynchronous-processing)

By default, HubSpot API calls are processed asynchronously using Laravel queues to prevent form submission delays. Ensure your queue worker is running:

```
php artisan queue:work

```

To process synchronously (not recommended for production), disable async processing in the form connector settings.

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

**"Missing access token"**

- Verify your private app access token is correctly entered
- Ensure the private app has the required scopes

**"Invalid or missing email"**

- Check the "Email Field" setting matches your form field handle
- Ensure the email field contains a valid email address

**"API error 401"**

- Your access token may be invalid or expired
- Verify the private app is still active in HubSpot

**"API error 403"**

- The access token doesn't have required permissions
- Check the private app scopes include contact read/write access

### Debug Logging

[](#debug-logging)

Enable debug logging to see detailed API interactions:

```
// In your .env file
LOG_LEVEL=debug

```

Check `storage/logs/laravel.log` for detailed connector activity.

Security
--------

[](#security)

- Access tokens are never logged or exposed in error messages
- All API communications use HTTPS
- Email addresses are validated before sending to HubSpot
- Comprehensive input sanitization and validation

Available Connectors
--------------------

[](#available-connectors)

- **[Mailchimp Connector](https://statamic.com/addons/stokoe/forms-to-mailchimp-connector)** - Connect forms to Mailchimp lists

Support
-------

[](#support)

- **Marketplace**: [Forms To HubSpot Connector](https://statamic.com/addons/stokoe/forms-to-hubspot-connector)
- **Base Addon**: [Forms To Wherever](https://statamic.com/addons/stokoe/forms-to-wherever)
- **HubSpot API**: [Official Documentation](https://developers.hubspot.com/docs/api/crm/contacts)

License
-------

[](#license)

MIT License - Build amazing things with it!

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance85

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~26 days

Total

5

Last Release

75d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e983375a114dbe4a5808311fcb8f73e05c6e9201f7dd856ebeee0dde824dad30?d=identicon)[stokoe](/maintainers/stokoe)

---

Top Contributors

[![Michael-Stokoe](https://avatars.githubusercontent.com/u/2981213?v=4)](https://github.com/Michael-Stokoe "Michael-Stokoe (5 commits)")

### Embed Badge

![Health badge](/badges/stokoe-forms-to-hubspot-connector/health.svg)

```
[![Health](https://phpackages.com/badges/stokoe-forms-to-hubspot-connector/health.svg)](https://phpackages.com/packages/stokoe-forms-to-hubspot-connector)
```

###  Alternatives

[statamic/ssg

Generate static sites with Statamic.

254302.4k](/packages/statamic-ssg)[statamic/seo-pro

65440.7k](/packages/statamic-seo-pro)[jacksleight/statamic-bard-texstyle

17172.5k](/packages/jacksleight-statamic-bard-texstyle)[visuellverstehen/statamic-classify

A useful helper to add CSS classes to all HTML tags generated by the bard editor.

20116.8k](/packages/visuellverstehen-statamic-classify)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

2381.5k10](/packages/marcorieser-statamic-livewire)[withcandour/aardvark-seo

Save time and get your Statamic site to rank better with the SEO addon for Statamic.

13128.3k](/packages/withcandour-aardvark-seo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
