<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tejas Prajapati on Medium]]></title>
        <description><![CDATA[Stories by Tejas Prajapati on Medium]]></description>
        <link>https://medium.com/@prajapatitejas2846?source=rss-35173b445ebe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*czhiP7oMeCbCVR69cBMyXA.jpeg</url>
            <title>Stories by Tejas Prajapati on Medium</title>
            <link>https://medium.com/@prajapatitejas2846?source=rss-35173b445ebe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 03:26:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prajapatitejas2846/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Seamless Data Synchronization: HubSpot Integration with Laravel]]></title>
            <link>https://medium.com/simform-engineering/seamless-data-synchronization-hubspot-integration-with-laravel-605a8d37fce8?source=rss-35173b445ebe------2</link>
            <guid isPermaLink="false">https://medium.com/p/605a8d37fce8</guid>
            <category><![CDATA[crm]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[data-synchronization]]></category>
            <category><![CDATA[hubspot]]></category>
            <dc:creator><![CDATA[Tejas Prajapati]]></dc:creator>
            <pubDate>Mon, 07 Aug 2023 06:32:56 GMT</pubDate>
            <atom:updated>2023-08-07T06:32:56.473Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Achieve business brilliance through the harmonious HubSpot-Laravel integration.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4dodgjNiQ8j0WUVNj6Wlg.png" /></figure><h3>What is HubSpot?</h3><p>HubSpot is an integrated CRM platform with tools for marketing, sales, and customer service. It aids businesses in attracting, engaging, and satisfying customers through features such as CRM, email marketing, social media management, and analytics. Its user-friendly interface and integrations simplify marketing, lead tracking, and campaign measurement, fostering business growth via personalized experiences and robust customer relationships.</p><h3>Why integrate HubSpot with Laravel</h3><p>HubSpot features seamlessly enhance web apps for an efficient, personalized user experience with the Laravel framework. The robust PHP framework Laravel forms a reliable foundation for online applications. Integrating HubSpot CRM into Laravel enables effortless lead generation, email scheduling, and customer interaction tracking.</p><p>Companies can use HubSpot forms to directly collect user data from Laravel-based websites. This data can be processed and stored in the Laravel application database for streamlined lead management. Integration with HubSpot’s email marketing enables personalized and automated campaigns based on user behavior, boosting engagement and conversions.</p><p>HubSpot’s CRM, combined with Laravel’s dynamic development, offers a robust solution for enhancing customer engagement and operational efficiency.</p><h3>Steps for HubSpot Account Setup</h3><p>First, we need to create a HubSpot account. <a href="https://developers.hubspot.com/get-started">Click here to create one</a>. <br>After creating, follow the below steps:</p><p><strong>1. Create HubSpot Access Token:</strong> Go to Settings &gt; Private App &gt; Create App. Now switch to Auth tab to get Access Token for API call.</p><p><strong>2. Create HubSpot Form: </strong>Go to Marketing &gt; Lead Capture &gt; Form. Finally, obtain the form script for use in our blade file.</p><p><strong>3. Create Email Template: </strong>Go to Marketing &gt; Email. Design the desired Email Template for our workflow to send emails to new contacts upon form submission.</p><p><strong>4. Create HubSpot Workflow: </strong>Go to Automation &gt; Workflow. Choose Contact Based Workflow and select “form submission” as a trigger. For the action, choose “send email” and select the template created in step 3.</p><p>So, when we insert the form code in our Laravel app, and the user submits it, this triggers the workflow to send a welcome email from Hubspot.</p><h3>Steps for Laravel 8 and HubSpot Integration</h3><ul><li><strong>Step 1: </strong>Install a fresh new Laravel 8 application</li><li><strong>Step 2: </strong>Install hubspot-apiclient Package</li><li><strong>Step 3: </strong>Set HubSpot API Key</li><li><strong>Step 4: </strong>Create Controller File</li><li><strong>Step 5: </strong>Create Routes</li><li><strong>Step 6: </strong>Create Blade File</li><li><strong>Step 7: </strong>Testing</li><li><strong>Step 8: </strong>Conclusion</li></ul><h4><strong>Step 1: </strong>Install a fresh new Laravel 8 application</h4><p>Let us begin with installing a new Laravel application. If you have already created the project, skip this step.</p><pre>composer create-project laravel/laravel hubspot-integration</pre><h4><strong>Step 2: </strong>Install hubspot-apiclient package</h4><p>Install hubspot-apiclient via the Composer package manager. This is required to communicate with HubSpot using the API key we have generated during HubSpot setup.</p><pre>composer require hubspot/api-client</pre><h4><strong>Step 3: </strong>Set HubSpot API key</h4><p>Add the HubSpot access token we have created in Hubspot Setup Step 1 in <strong>.env</strong> file.</p><pre>HUBSPOT_ACCESS_TOKEN = your_hubspot_access_token</pre><h4><strong>Step 4: </strong>Create a controller file</h4><p>Here, create a new controller as <strong>UserController </strong>and write a method like the one below.</p><p><strong>app/Http/Controllers/UserController.php</strong></p><pre>&lt;?php<br><br>namespace App\Http\Controllers;<br><br>use App\Models\User;<br>use Illuminate\Http\Request;<br>use App\Models\HubspotContact;<br>use Yajra\DataTables\DataTables;<br>use Illuminate\Support\Facades\Hash;<br>use Illuminate\Http\JsonResponse;<br>use Illuminate\Contracts\View\View;<br><br>class UserController extends Controller<br>{<br>  /**<br>   * This function is used to fetch contact list from hubspot<br>   *<br>   * @param Request $request<br>   * @return JsonResponse<br>   */<br>  public function userList(Request $request): JsonResponse<br>  {<br>    try {<br>      $contacts = collect(getContact());<br>      $datatablesData = $contacts-&gt;map(function ($contact) {<br>        return [<br>          &#39;id&#39; =&gt; $contact[&#39;id&#39;],<br>          &#39;first_name&#39; =&gt; $contact[&#39;properties&#39;][&#39;firstname&#39;] ?? &#39;&#39;,<br>          &#39;last_name&#39; =&gt; $contact[&#39;properties&#39;][&#39;lastname&#39;] ?? &#39;&#39;,<br>          &#39;email&#39; =&gt; $contact[&#39;properties&#39;][&#39;email&#39;] ?? &#39;&#39;,<br>          &#39;createdate&#39; =&gt; $contact[&#39;properties&#39;][&#39;createdate&#39;] ?? &#39;&#39;,<br>          &#39;lastmodifieddate&#39; =&gt; $contact[&#39;properties&#39;][&#39;lastmodifieddate&#39;] ?? &#39;&#39;<br>        ];<br>      });<br><br>      if ($request-&gt;ajax()) {<br>        return Datatables::of($datatablesData)-&gt;addIndexColumn()<br>          -&gt;make(true);<br>      }<br>    } catch (\Exception $e) {<br>      echo &#39;Error : &#39;.$e-&gt;getMessage();<br>    }<br>  }<br><br>  /**<br>   * This function is used to display contact list from hubspot<br>   *<br>   * @return View<br>   */  <br>  public function displayUser(): View<br>  {<br>    return view(&#39;home&#39;);<br>  }<br>  <br>  /**<br>   * This function is used to display signup form for contact<br>   *<br>   * @return View<br>   */<br>  public function signupUser(): View<br>  {<br>    return view(&#39;singup_news&#39;);<br>  }<br>}</pre><p>Here is the <strong>Helpers.php</strong> file in which we have written HubSpot logic provided by Hubspot for PHP SDK. <a href="https://developers.hubspot.com/docs/api/crm/contacts">You may view the API docs</a> here.</p><pre>&lt;?php<br><br>use App\Models\HubspotContact;<br>use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectInput;<br>use HubSpot\Factory;<br>use HubSpot\Client\Crm\Contacts\ApiException;<br><br>if (!function_exists(&#39;getContact&#39;)) {<br><br>    function getContact()<br>    {<br>        $client = Factory::createWithAccessToken(env(&#39;HUBSPOT_ACCESS_TOKEN&#39;));<br>        try {<br>            $apiResponse = $client-&gt;crm()-&gt;contacts()-&gt;basicApi()-&gt;getPage(100,true);<br>            return $apiResponse[&#39;results&#39;];<br>        } catch (ApiException $e) {<br>            echo &quot;Exception when calling basic_api-&gt;get_page: &quot;, $e-&gt;getMessage();<br>        }<br>    }<br>}</pre><h4><strong>Step 5: </strong>Create Routes</h4><p>Next, we will create routes — one for fetching a list of contacts from HubSpot and another to integrate the HubSpot form to create a contact in HubSpot.</p><p><strong>routes/web.php</strong></p><pre>&lt;?php<br><br>use Illuminate\Support\Facades\Route;<br>use App\Http\Controllers\UserController;<br>/*<br>|--------------------------------------------------------------------------<br>| Web Routes<br>|--------------------------------------------------------------------------<br>|<br>| Here is where you can register web routes for your application. These<br>| routes are loaded by the RouteServiceProvider within a group which<br>| contains the &quot;web&quot; middleware group. Now create something great!<br>|<br>*/<br><br>//DISPLAY HUBSPOT USERS <br>Route::get(&#39;/users&#39;, [UserController::class, &#39;displayUser&#39;])-&gt;name(&#39;display.user&#39;);<br>//HUBSPOT USERS <br>Route::get(&#39;/hubspot-user&#39;, [UserController::class, &#39;userList&#39;])-&gt;name(&#39;hubspot.user&#39;);<br>//SIGNUP NEWS LETTER To CREATE USER<br>Route::get(&#39;/signup-news&#39;, [UserController::class, &#39;signupUser&#39;])-&gt;name(&#39;signup.user&#39;);</pre><h4>Step 6: Create Blade File</h4><p>In this step, let’s create <strong>home.blade.php</strong> (<strong>resources/views/home.blade.php</strong>)</p><p>For layout, use datatable to display records. We have created another view file <strong>signup_news.blade.php</strong> (<strong>resources/views/signup_news.blade.php</strong>) for our Hubspot form integration directly on our site.</p><p><strong>home.blade.php</strong></p><pre>&lt;!doctype html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;title&gt;Hubspot User&lt;/title&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;ie=edge&quot;&gt;<br>    &lt;!--Bootstrap 5 Include --&gt;<br>    &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;<br>        integrity=&quot;sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC&quot; crossorigin=&quot;anonymous&quot;&gt;<br>    &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js&quot;<br>        integrity=&quot;sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM&quot; crossorigin=&quot;anonymous&quot;&gt;<br>    &lt;/script&gt;<br>    &lt;!--Bootstrap Icon --&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot;&gt;<br>    &lt;!--Jquery Include--&gt;<br>    &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot;&gt;&lt;/script&gt;<br>    &lt;!--Datatable Include--&gt;<br>    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;https://cdn.datatables.net/1.10.25/css/jquery.dataTables.css&quot;&gt;<br>    &lt;script type=&quot;text/javascript&quot; charset=&quot;utf8&quot; src=&quot;https://cdn.datatables.net/1.10.25/js/jquery.dataTables.js&quot;&gt;&lt;/script&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;div&gt;<br>        &lt;nav class=&quot;navbar navbar-expand-lg navbar-dark bg-dark&quot;&gt;<br>            &lt;div class=&quot;container-fluid&quot;&gt;<br>                &lt;a class=&quot;navbar-brand&quot; href=&quot;/users&quot;&gt;Hubspot Integration&lt;/a&gt;<br>                &lt;button class=&quot;navbar-toggler&quot; type=&quot;button&quot; data-bs-toggle=&quot;collapse&quot;<br>                    data-bs-target=&quot;#navbarSupportedContent&quot; aria-controls=&quot;navbarSupportedContent&quot;<br>                    aria-expanded=&quot;false&quot; aria-label=&quot;Toggle navigation&quot;&gt;<br>                    &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;<br>                &lt;/button&gt;<br>                &lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;navbarSupportedContent&quot;&gt;<br>                    &lt;ul class=&quot;navbar-nav me-auto ml-lg-5 mb-lg-0&quot;&gt;<br>                        &lt;li class=&quot;nav-item p-2 pl-5&quot;&gt;<br>                            &lt;a class=&quot;nav-link active&quot; aria-current=&quot;page&quot; href=&quot;/users&quot;&gt;Home&lt;/a&gt;<br>                        &lt;/li&gt;<br>                        &lt;li class=&quot;nav-item p-2 pl-5&quot;&gt;<br>                            &lt;a class=&quot;nav-link active&quot; aria-current=&quot;page&quot; href=&quot;/signup-news&quot;&gt;Signup News&lt;/a&gt;<br>                        &lt;/li&gt;<br>                    &lt;/ul&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/nav&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;container mt-3&quot;&gt;<br>        &lt;table class=&quot;table table-responsive table-hover user_datatable&quot;&gt;<br>            &lt;thead&gt;<br>                &lt;tr&gt;<br>                    &lt;th&gt;ID&lt;/th&gt;<br>                    &lt;th&gt;First Name&lt;/th&gt;<br>                    &lt;th&gt;Last Name&lt;/th&gt;<br>                    &lt;th&gt;Email&lt;/th&gt;<br>                    &lt;th&gt;Created At&lt;/th&gt;<br>                    &lt;th&gt;Last Modified&lt;/th&gt;<br>                    &lt;th&gt;Edit&lt;/th&gt;<br>                    &lt;th&gt;Delete&lt;/th&gt;<br>                &lt;/tr&gt;<br>            &lt;/thead&gt;<br>            &lt;tbody&gt;&lt;/tbody&gt;<br>        &lt;/table&gt;<br>    &lt;/div&gt;<br>    &lt;script type=&quot;text/javascript&quot;&gt;<br>        $(function() {<br>            var table = $(&#39;.user_datatable&#39;).DataTable({<br>                processing: true,<br>                serverSide: true,<br>                ajax: &quot;{{ route(&#39;hubspot.user&#39;) }}&quot;,<br>                columns: [{<br>                        data: &#39;id&#39;,<br>                        name: &#39;id&#39;<br>                    },<br>                    {<br>                        data: &#39;first_name&#39;,<br>                        name: &#39;first_name&#39;<br>                    },<br>                    {<br>                        data: &#39;last_name&#39;,<br>                        name: &#39;last_name&#39;<br>                    },<br>                    {<br>                        data: &#39;email&#39;,<br>                        name: &#39;email&#39;<br>                    },<br>                    {<br>                        data: &#39;createdate&#39;,<br>                        name: &#39;createdate&#39;<br>                    },<br>                    {<br>                        data: &#39;lastmodifieddate&#39;,<br>                        name: &#39;lastmodifieddate&#39;<br>                    }<br>                ]<br>            });<br>        });<br>    &lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p><strong>signup_news.blade.php</strong></p><p>Here, you need to embed your Hubspot form script to integrate the form. So when users submit the form, their details will be stored in the contact object. And the workflow that we have created will trigger, sending an email to the user’s provided address.</p><pre>&lt;!doctype html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;title&gt;Sign Up News&lt;/title&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;ie=edge&quot;&gt;<br>    &lt;!--Bootstrap 5 Include --&gt;<br>    &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;<br>        integrity=&quot;sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC&quot; crossorigin=&quot;anonymous&quot;&gt;<br>    &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js&quot;<br>        integrity=&quot;sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM&quot; crossorigin=&quot;anonymous&quot;&gt;<br>    &lt;/script&gt;<br>    &lt;!--Bootstrap Icon --&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot;&gt;<br>    &lt;!--Jquery Include--&gt;<br>    &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot;&gt;&lt;/script&gt;<br>    &lt;!--Datatable Include--&gt;<br>    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;https://cdn.datatables.net/1.10.25/css/jquery.dataTables.css&quot;&gt;<br>    &lt;script type=&quot;text/javascript&quot; charset=&quot;utf8&quot; src=&quot;https://cdn.datatables.net/1.10.25/js/jquery.dataTables.js&quot;&gt;&lt;/script&gt;<br>&lt;/head&gt;<br>&lt;style&gt;<br>    /* Center the form container */<br>&lt;/style&gt;<br><br>&lt;body&gt;<br>    &lt;div&gt;<br>        &lt;nav class=&quot;navbar navbar-expand-lg navbar-dark bg-dark&quot;&gt;<br>            &lt;div class=&quot;container-fluid&quot;&gt;<br>                &lt;a class=&quot;navbar-brand&quot; href=&quot;/users&quot;&gt;Hubspot Integration&lt;/a&gt;<br>                &lt;button class=&quot;navbar-toggler&quot; type=&quot;button&quot; data-bs-toggle=&quot;collapse&quot;<br>                    data-bs-target=&quot;#navbarSupportedContent&quot; aria-controls=&quot;navbarSupportedContent&quot;<br>                    aria-expanded=&quot;false&quot; aria-label=&quot;Toggle navigation&quot;&gt;<br>                    &lt;span class=&quot;navbar-toggler-icon&quot;&gt;&lt;/span&gt;<br>                &lt;/button&gt;<br>                &lt;div class=&quot;collapse navbar-collapse&quot; id=&quot;navbarSupportedContent&quot;&gt;<br>                    &lt;ul class=&quot;navbar-nav me-auto ml-lg-5 mb-lg-0&quot;&gt;<br>                        &lt;li class=&quot;nav-item p-2 pl-5&quot;&gt;<br>                            &lt;a class=&quot;nav-link active&quot; aria-current=&quot;page&quot; href=&quot;/users&quot;&gt;Home&lt;/a&gt;<br>                        &lt;/li&gt;<br>                        &lt;li class=&quot;nav-item p-2 pl-5&quot;&gt;<br>                            &lt;a class=&quot;nav-link active&quot; aria-current=&quot;page&quot; href=&quot;/signup-news&quot;&gt;Signup News&lt;/a&gt;<br>                        &lt;/li&gt;<br>                    &lt;/ul&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/nav&gt;<br>    &lt;/div&gt;<br>    &lt;div id=&quot;form-container&quot;&gt;<br>        &lt;!-- Embeded Sign Up HubSpot form code here --&gt;<br><br>        &lt;!-- End Here --&gt;<br>        &lt;div class=&quot;container mt-5 text-center&quot;&gt;<br>            &lt;span class=&quot;h3&quot;&gt;Enter Details To Create Contact In Hubspot&lt;/span&gt;<br>            &lt;div id=&quot;hubspot-form-container&quot;&gt;&lt;/div&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h4>8. Testing</h4><p>Lastly, we have to type the given command and hit enter to run the laravel app:</p><pre>php artisan serve</pre><p>Open the web browser, type the given URL, and view the app output</p><pre>http://127.0.0.1:8000/users</pre><h3>Conclusion</h3><p>HubSpot and Laravel empower businesses to optimize customer engagement. Integrating HubSpot’s tools like email workflows and contact management with Laravel’s framework, streamlines data collection, personalized communication, and user journey automation. This partnership enhances lead nurturing, strengthens customer bonds, and boosts operational efficiency, leading to substantial business growth.</p><blockquote>To stay up-to-date with the latest trends in the development ecosystem, follow<strong> </strong><a href="https://medium.com/simform-engineering"><strong>Simform Engineering.</strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=605a8d37fce8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/simform-engineering/seamless-data-synchronization-hubspot-integration-with-laravel-605a8d37fce8">Seamless Data Synchronization: HubSpot Integration with Laravel</a> was originally published in <a href="https://medium.com/simform-engineering">Simform Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>