You can use the HTTP Integration to integrate to a variety of API Endpoints. An example of where you can do this is with Hubspot Forms.
If you are unable to integrate directly into a Hubspot instance using the direct Integrate to Hubspot job, then you may be able to do this using HTTP Integration.
While the integration mentioned above is the best way to submit leads into Hubspot securely and provide more transparency on a lead's status when being submitted, you may need to use the HTTP integration for the following reasons:
- Your client is unable to provide you access to the Hubspot instance required for direct integration
- Your client has provided you with an Hubspot form to submit to, which cannot be achieved with the direct integration
In general, you will be able to tell which integration you need by the data you've been provided:
- API Key, REST field names: Direct
- Form URL/Documentation: HTTP Integration
Below we will go through how to set up the HTTP Integration to submit data to a Hubspot Form.
- Portal ID
- Form ID
- HTML Field Values
Please note, we will be using this version of the Hubspot API to complete this integration.
1. Within your HTTP Integration configuration, you need to input your API URL at the very top. For this, you need your Site ID.
For Hubspot Forms, the API URL always has the same format as seen in their provided documentation:
In this URL, you will need to replace :portalId and :formGuid with the relevant IDs, as seen in the configuration window below.
Note: Please ensure that you remove the colons (:) from the URL. As mentioned above, leaving these in will lead to the integration failing.
Also ensure that your method is set to 'post', and send_as_json is set to '1' as per the Hubspot document.
2. This Hubspot implementation requires a more advanced implementation of the HTTP Integration. To facilitate this, you will need to add send_body as a parameter of the API section, and set this to 1.
3. The next area you need to populate is the mapping section. With Hubspot, they require their field mappings to be set up as a JSON body (example screenshot from Hubspot below):
By default, a regular HTTP request will not meet this criteria, so this structure needs to be implemented within the HTTP setup.
The only required section is the fields section on row 5. To do this, you need first to change the mapping header to 'bodyContent':
Underneath this, you can add the fields section as below:
In order to mirror the JSON body provided above, you will need to add each field as its own section of the integration. For the email field, it would look like this:
Here, the 'name' parameter refers to the Hubspot HTML field name that you want to map to. The 'value' parameter is the corresponding Convertr field name. This would submit the data point correctly as per Hubspot's instructions.
Note: If the Convertr field name is the same as the Hubspot field name, this will not work without using our Integration Filters.
In the above example for email, 'email' is the field name for both Convertr and Hubspot. This will mean the lead data from that field will be pulled through for both 'name' and 'value', where it is only required for 'value'.
In this case, you need to use the |hardcode value to allow Convertr to ignore the lead data for the 'name' value, as below:
You can then add your additional mapping underneath like this:
This is all that is required to send lead data to Hubspot! You can also include the context and legalConsentOptions from the JSON body if you or your client require data included there, but it should work like this. See below a complete example with these two included.
This will complete your HTTP Integration to an Hubspot form! Please ensure to test and confirm with your client before beginning delivery through this integration.
Import from JSON
If you would like to copy an example of how this integration should look, you can import a JSON example into your HTTP configuration as a starting point by clicking Import from JSON in your HTTP job:
In here, you can copy the below JSON:
"text":"I agree to allow Example Company to store and process my personal data.",
"text":"I agree to receive marketing communications from Example Company."
Once you click Save, this will update your HTTP job to show this configuration. You can then make changes to suit your needs.
For more information on how you can use the HTTP Integration, see here.