Send external form data to hubspot

Highlighted
New Contributor

 I have a wordpress registration form and how can I send data from that form to hubspot, I need more explanatory information, someone who can help me.

 

query link 

 

https://developers.hubspot.com/docs/methods/forms/submit_form 

Reply
0 Upvotes
5 Replies 5
HubSpot Employee

Hi @btc2 ,

 

What difficulties are you currently facing? The documentation you linked is our forms API which is typically used to integrate an external form to HubSpot. It's particularly useful if you want to have total control of the form look/feel and submission logic whilst ensuring the data captured is securely sent to HubSpot.

 

I'm happy to answer any specific questions you might have. Some other ideas might be to consider using an embedded hubspot form in place of the current form? 

 

- Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
Reply
0 Upvotes
New Contributor
I have a registration form for a community, but it is an external hubspot form, I integrate the API code in PHP language, with the portal and form data.

 

Captura de pantalla (18).png

Reply
0 Upvotes
HubSpot Employee

Hi @btc2 ,

The issue is with the URL you are posting to. You currently have:

 

/submissions/v2/post/upload/{portalId}/{formGuid}';

 

Whereas it should be:

 

/submissions/v2/post/upload/portalId/formGuid';

In otherwords you need to remove the "{" and "}" symbols. Can you try that and let me know. 

 

Jack

 

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
Reply
0 Upvotes
New Contributor
connected successfully thanks, but send the form with empty fields to hubspot,
the fields in my web form are almost equal to the form I created in Hubspot, the difference is the password fields that are not included in the Hubspot form.
Reply
0 Upvotes
HubSpot Employee

Thats good to hear @BT . One thing I would say is that you should not be storing password information in your HubSpot portal. For everything else you can include it in your POST request. Typically the process looks something like this:

 

I have a form with the following fields:

 

<form id="contact-form" method="post" action="submit.php">
  First Name:<input type="text" name="firstname">
  Last Name:<input type="text" name="lastname">
Email Address: <input type="text" name="email">   Country:<input type="text" name="country">   <input type="submit" value="Submit"> </form>

Then in my submit.php file I would have to get the data from the POST array:

 

$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$country = $_POST['country'];

Then I would formulate my string of data I want to post like this:

 

$str_post = "firstname=" . urlencode($firstname) 
    . "&lastname=" . urlencode($lastname) 
    . "&email=" . urlencode($email) 
    . "&country=" . urlencode($country) 
    . "&hs_context=" . urlencode($hs_context_json); 

And make the POST request. The data should be updated accordingly. It's important to note that the fields I include in the code above are the internal property values of the HubSpot properties I wish to update.

 

Also worth noting the "hs_context" parameter is very important. That is used to pass meta data relating to the form submission into HubSpot. It can associate a contact record in HubSpot to the usertoken/cookie on the browser.

 

Let me know if this helps!

 

- Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
Reply
0 Upvotes