Add Contact To Your Hubspot

Push Your Contacts Using REST API'S

techhawa-hubspot-api-home

Your HubSpot contacts database draws details from every touchpoint between your leads and your brand and organizes them all for you in one place. Your contacts database is the heart of your marketing and sales efforts. This article walks through adding your existing contacts into HubSpot so you can begin nurturing your leads further down the inbound funnel.

There are a few ways you can add contacts into HubSpot:

  • Manually create an individual contact.
  • Import a list of contacts.
  • Import using another integration.
  • Using REST API'S.

#Adding Contact's To Your Hubspot Using API'S

  • Login into Hubspot Dashboard.
  • Now click on integration's on top-right nav bar as shown below.

  • hubspot-instegrations-option
  • Now go to Hubspot API key section and click on create new key.

  • hubspot_api_key_create
  • Now copy and store the API Key (which is used in further to call API).

  • hubspot-api-key-copy
  • Now replace the YOUR-HubSpot-KEY in the below code.

  • <?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.hubapi.com/contacts/v1/contact?hapikey=YOUR-HubSpot-KEY",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "{\r\n  \"properties\": [\r\n  
      {\r\n      \"property\": \"email\",\r\n      \"value\": \"[email protected]\"\r\n   
     },\r\n    {\r\n      \"property\": \"firstname\",\r\n      \"value\": \"Techhawa\"\r\n  
      },\r\n    {\r\n      \"property\": \"lastname\",\r\n      \"value\": \".com\"\r\n    
    },\r\n    {\r\n      \"property\": \"website\",\r\n      \"value\": \"https://www.techhawa.com\"\r\n 
       },\r\n    {\r\n      \"property\": \"company\",\r\n      \"value\": \"Techhawa\"\r\n    },\r\n  
      {\r\n      \"property\": \"phone\",\r\n      \"value\": \"555-122-2323\"\r\n    },\r\n    {\r\n   
       \"property\": \"address\",\r\n      \"value\": \"25 First Street\"\r\n    },\r\n    {\r\n     
     \"property\": \"city\",\r\n      \"value\": \"Cambridge\"\r\n    },\r\n    {\r\n     
     \"property\": \"state\",\r\n      \"value\": \"MA\"\r\n    },\r\n    {\r\n   
       \"property\": \"zip\",\r\n      \"value\": \"02139\"\r\n    }\r\n  ]\r\n}",
      CURLOPT_HTTPHEADER => array(
        "cache-control: no-cache",
        "content-type: application/json",
        "postman-token: c6f0a7d5-31be-fbfa-9776-a79423e85df4"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    

  • Now save the code in php file on your server and run it.
  • You will see JSON response of contact created.
  • You can check in contact section in Hubspot dashboard.

  • hubspot-add-contact-result

#3. Integration of source code

  • Go to AWS IAM Users.
  • Copy and paste the below code on your webpage.

  • <meta name="viewport" content="width=device-width">
    <form action="/purchase" method="POST">
    <!-- Note that the amount is in paise = 50 INR -->
    <script
        src="https://checkout.razorpay.com/v1/checkout.js"
        data-key="<YOUR_KEY_ID>"
        data-amount="50000"
        data-buttontext="Pay with TechHawa"
        data-name="Merchant Name"
        data-description="Purchase Description"
        data-image="https://your-awesome-site.com/your_logo.jpg"
        data-prefill.name="TechHawa"
        data-prefill.email="[email protected]"
        data-theme.color="#F37254"
    ></script>
    <input type="hidden" value="Hidden Element" name="hidden">
    </form>
    
  • Now replace the key-id in the above code and save the file with .html.
  • Note: For live change the mode in top nav bar and copy the LIVE KEY-ID .

  • You can see the demo below.


  • Live Demo