Integrate HubSpot CRM with Magento 2

HubSpot CRM provides all the tools you need to attract, manage, and make better relationships with customers. It offers Marketing, Sales and Customer Service software which are developed with a completely free CRM platform. Say goodbye to complex and unuseful software, store owners can easily manage and grow their businesses with HubSpot. Currently, Magento 2 does not support integration with Hubspot. To solve this problem, Mageplaza develops Webhook module which helps to integrate Magento 2 with HubSpot and grow your business.

What Is Webhook?

Webhook is a helpful tool which allows online stores to configure to send an API request to a configurable destination (URL) such as other servers or applications in cases trigger events including new order, customer login, abandoned carts, etc occur. As a result, store owners can instantly update important notifications and have suitable activities shortly.

Table of Content

Webhook supports these below entities of Magento:

  • Customer
  • Order
  • Invoice
  • Shipment
  • Credit Memo
  • Product
  • Category
  • Abandoned Cart

These entities of Hubspot:

  • Contacts
  • Companies
  • Deals
  • Events

    How To Integrate HubSpot CRM With Magento 2 With Webhook

Instructions For Registering And Using HubSpot CRM

Access to here, Click Sign up & Fill out the registration form to register a new user or sign up with Google Instructions For Registering And Using HubSpot Instructions For Registering And Using HubSpot

After sign up Hubspot account successfully, please click on your account icon on the top right corner of the screen > select Integrations > API key > Show key. This is the API key which is used to integrate Hubspot with Magento 2.

How To Integrate HubSpot with Magento 2 With Webhook

These Fields Of HubSpot CRM

To view the latest fields of Hubspot, you can click here

Instructions For Creating Hook

How to create a new lead in HubSpot CRM via Magento 2

Required fields

  • email
  • first name
  • last name

Optional fields

  • website
  • company
  • phone
  • address
  • city
  • state
  • zip

In this part, I will give detail instructions on how to configure Webhook which helps Magento 2 integrate with HubSpot.

From the Admin Panel, go to System > Webhook > Manage Hooks, select Add New on the right corner, then you will see many options including New Order, New Customer, Update Customer, Delete Customer, etc.

Step 1: Fill all information in the General Information tab

How to create a new lead in Hubspot via Magento 2 step 1

Step 2: Enter the data on the Action tab

How to create a new lead in Hubspot via Magento 2 Step 2 How to create a new lead in Hubspot via Magento 2 Step 2 image 2

Note Payload URL:

Headers: Click Add button to add values of headers such as Name and Value, according to requests of servers, in order to call this API. The Value field is the API key coming from Hubspot.

  • Name = hapikey, Value = the API key coming from Hubspot
  • For example:

How to create a new lead in Hubspot via Magento 2 image 3

Body: With POST or PUT method, you need to add content on the Content section to send the request. Click Insert Variable to choose variable.

  • For example: When you create a hook with the customer with the POST method, you need to insert the following content into Body part:
{
 "properties": [
   {
     "property": "email",
     "value": "testingapis@hubspot.com"
   },
   {
     "property": "firstname",
     "value": "Adrian"
   },
   {
     "property": "lastname",
     "value": "Mott"
   },
      {
     "property": "company",
     "value": "HubSpot"
   },
   {
     "property": "phone",
     "value": "555-122-2323"
   },
   {
     "property": "address",
     "value": "25 First Street"
   },
   {
     "property": "city",
     "value": "Cambridge"
   },
   {
     "property": "state",
     "value": "MA"
   }
     ]
}

Note: If you want to get any data field, you need to change the value of this data field with variable coming from Insert Variable.

The result of creating a hook:

Instructions For Creating Hook 1

Once some events of Store such as adding a new customer, new order, etc occurs, the data will be saved on Hook Logs:

Instructions For Creating Hook 2 Hook Logs

The Result Shown In Hubspot CRM:

The Result Shown In Hubspot

These Available Body Templates

New Deals

End point: POST /deals/v1/deal/

Required fields:

  • dealname
  • pipeline
  • dealstage

Optional fields:

  • hubspot_owner_id
  • amount
  • dealtype

Payload URL: https://api.hubapi.com/deals/v1/deal

Headers: Name = hapikey, Value is the API key coming from Hubspot

Body Template:

{
   "properties": [
   {
     "value": "Tim's Newer Deal",
     "name": "dealname"
   },
   {
     "value": "appointmentscheduled",
     "name": "dealstage"
   },
           {
     "value": 1409443200000,
     "name": "closedate"
   },
   {
     "value": "60000",
     "name": "amount"
   },
   {
     "value": "newbusiness",
     "name": "dealtype"
   }
 ]
}

Note: If you want to get any data field, you need to change the value of this data field with variable coming from Insert Variable.

Conclusion

In this tutorial, we introduce how to register Hubspot, create Hook with Mageplaza Webhook Magento2, and integrate HubSpot CRM with Magento 2. In addition, you can refer to other useful extensions for your store.

Learn More Webhook Magento 2






Back Ask Mageplaza

magento-2-tutorial
webhook