PHPackages                             visualbuilder/filament-hubspot - 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. [API Development](/categories/api)
4. /
5. visualbuilder/filament-hubspot

ActiveLibrary[API Development](/categories/api)

visualbuilder/filament-hubspot
==============================

Syncs leads from HubSpot

4.0.2(8mo ago)03.2k—9.1%[2 PRs](https://github.com/visualbuilder/filament-hubspot/pulls)MITPHPPHP ^8.2CI passing

Since Mar 14Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/visualbuilder/filament-hubspot)[ Packagist](https://packagist.org/packages/visualbuilder/filament-hubspot)[ Docs](https://github.com/visualbuilder/filament-hubspot)[ GitHub Sponsors]()[ RSS](/packages/visualbuilder-filament-hubspot/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelogDependencies (9)Versions (9)Used By (0)

Filament HubSpot Integration
============================

[](#filament-hubspot-integration)

[![Latest Version on Packagist](https://camo.githubusercontent.com/95c086a8c7f95dfdcd37ac4a75323f1388fcd84ff660819296beb0082992c301/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76697375616c6275696c6465722f66696c616d656e742d68756273706f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/visualbuilder/filament-hubspot)[![GitHub Tests Action Status](https://camo.githubusercontent.com/f21154528a492cf9c52edcda6df5f6e8c260147a0aa41809c4f8aa51eb983cd4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f76697375616c6275696c6465722f66696c616d656e742d68756273706f742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/visualbuilder/filament-hubspot/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/ffdb77775e24366f4cd625d4396cae898b1b026532202cfc9ddf3bb3ad49d925/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f76697375616c6275696c6465722f66696c616d656e742d68756273706f742f6669782d7068702d636f64652d7374796c696e672e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/visualbuilder/filament-hubspot/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/b3797281fe10cabc019e2655d4317cec80fae9e195a5cdca0f6c7b27247e2d60/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76697375616c6275696c6465722f66696c616d656e742d68756273706f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/visualbuilder/filament-hubspot)

📌 Overview
----------

[](#-overview)

This package provides:

- A **Laravel Facade wrapper** for the [HubSpot API PHP Library](https://github.com/HubSpot/hubspot-api-php).
- A **customizable webhook** (`/api/hubspot/webhook`) to receive **contact updates** from HubSpot.
- An **event-driven sync system** (`SyncHubspotContactListener`) to automatically sync contacts from HubSpot to Laravel.

This package is a **quick-start solution** for integrating **HubSpot contacts** into a **Laravel + Filament** sales pipeline.

---

🚀 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require visualbuilder/filament-hubspot
```

Publish the config file:-

```
php artisan vendor:publish --tag="filament-hubspot-config"
```

If you wish to use the provided lead model then run the install command to setup the migration

```
php artisan filament-hubspot:install
```

🔑 HubSpot API Setup
-------------------

[](#-hubspot-api-setup)

### 1️⃣ **Obtain HubSpot API Credentials**

[](#1️⃣-obtain-hubspot-api-credentials)

1. Go to **HubSpot &gt; Settings &gt; Account Management &gt; Integrations**.
2. Navigate to **Connected Apps** or **Private Apps**.
3. Generate an **Access Token** and **Client Secret**.

### 2️⃣ **Add credentials to `.env`**

[](#2️⃣-add-credentials-to-env)

```
HUBSPOT_ACCESS_TOKEN=pat-eu1-xxxxx
HUBSPOT_CLIENT_SECRET=xxxxx-xxx-xxxxx
```

Testing the connection. The HubSpot API should now be available on the HubSpot Facade. You can test with tinker or in a console command:-

```
    $response = HubSpot::crm()->contacts()->basicApi()->getPage();
    foreach ($response->getResults() as $contact) {
         dump($contact->getProperties());
    }
```

Webhook
-------

[](#webhook)

On your app, add the events that should trigger a webhook and point to `yourdomain.com/api/hubspot/webhook`

### Local Webhook testing

[](#local-webhook-testing)

For local testing of webhooks use ngrok or smee to route requests to your local server

```
 ngrok http localhost:80
```

Which should provide a url which can be used in HubSpot:-

```
Forwarding  https://a5ed-18-170-5-16.ngrok-free.app -> http://localhost:80
```

Paste this URL into the Hubspot App webhooks section and define your events to trigger call. On this page you can send a test webhook.

Ngrok should output something like

```
05:20:45.763 GMT POST /api/hubspot/webhook      200 OK
```

This indicates the POST has been received and validated and the `HubspotWebhookReceived` Event will be triggered

The provided `SyncHubspotContactListener` will be called each time the Webhook is received.

Add your own custom Listeners in the config

```
        /**
         * What to do when a webhook is received
         */
        'listeners'           => [
            Visualbuilder\FilamentHubspot\Events\HubspotWebhookReceived::class => [
                Visualbuilder\FilamentHubspot\Listeners\SyncHubspotContactListener::class,
                // Additional listeners can be added here...
            ],
        ],
```

If you are getting 401 Unauthorized, check the keys and your server time. Valid requests must be within 5 minutes so clocks must be correct.

### Synching a local model

[](#synching-a-local-model)

Set your model that should receive the HubSpot Contact and set which attributes to update.

```
   /*
    |--------------------------------------------------------------------------
    | HubSpot Webhook Options
    |--------------------------------------------------------------------------
    |  Enabling adds a route at /api/hubspot/webhook
    |  Valid requests will trigger an event HubspotWebhookReceived
    |
    */
    'webhook'           => [
        'enabled'             => env('HUBSPOT_WEBHOOK_ENABLED', true),
        'slug'                => env('HUBSPOT_WEBHOOK_SLUG', 'api/hubspot/webhook'),

        /**
         * Replace this with your own Contact Model preference
         */
        'local_contact_model' => \App\Models\Lead::class,
        'match_on_attribute'  => [
            'hubspot'    => 'email',
            'localModel' => 'email'
        ],
```

### Set field mapping

[](#set-field-mapping)

```
 /*
     |--------------------------------------------------------------------------
     | HubSpot Contact to local Model mappings
     |--------------------------------------------------------------------------
     |  Setup hubspot fields =>  model attribute mapping
     |  These fields will be requested from hubspot, the values are the model mappings
     |
     */
    'mappings'          => [
        'firstname'        => ['attribute' => 'first_name'],
        'lastname'         => ['attribute' => 'last_name'],
        'email'            => ['attribute' => 'email'],
        'company'          => ['attribute' => 'company'],
        'website'          => ['attribute' => 'website'],
        'jobtitle'         => ['attribute' => 'job_title'],
        'message'          => ['attribute' => 'message'],
        'lastmodifieddate' => ['attribute' => 'updated_at'],
        'lifecyclestage'   => ['attribute' => null],
        'hs_object_id'     => ['attribute' => 'hs_id'],

        // Relations can be added and auto created if not existing
        // in this case leadsource may contain LinkedIn, Facebook etc as a string and will populate a related model if the source is not found
        'leadsource'       => [
            'relation'         => 'leadSource',
            'lookup_field'     => 'name',           // the column to find or create related model
            'foreign_key'      => 'lead_source_id', // optional, otherwise inferred automatically
            'not_found_action' => 'create',         // use ignore or create missing lookup relation
        ],
    ],
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Lee Evans](https://github.com/visualbuilder)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance70

Regular maintenance activity

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68.4% 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 ~60 days

Recently: every ~76 days

Total

6

Last Release

127d ago

Major Versions

1.0.1 → 4.0.12025-08-19

PHP version history (2 changes)1.0.0PHP ^8.1

4.0.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/133e7275d57b3053e870a66332b987ae0be489e1c61938f22196d42cf19d2be9?d=identicon)[ekoukltd](/maintainers/ekoukltd)

---

Top Contributors

[![cannycookie](https://avatars.githubusercontent.com/u/500822?v=4)](https://github.com/cannycookie "cannycookie (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

laravelvisual builderfilament-hubspot

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/visualbuilder-filament-hubspot/health.svg)

```
[![Health](https://phpackages.com/badges/visualbuilder-filament-hubspot/health.svg)](https://phpackages.com/packages/visualbuilder-filament-hubspot)
```

###  Alternatives

[rupadana/filament-api-service

A simple api service for supporting filamentphp

204103.8k7](/packages/rupadana-filament-api-service)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[tapp/filament-webhook-client

Add a Filament resource and a policy for Spatie Webhook client

1120.2k](/packages/tapp-filament-webhook-client)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)

PHPackages © 2026

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