Collect HubSpot Form submissions
This is a 'Workflow' template which means that it is a single standalone workflow.
Some workflow templates can be modified to work with other workflow templates - e.g. to convert a data sync between two services from uni-directional to bi-directional
OverviewCopy
This workflow allows you to use HubSpot Form Submission Data easily within your marketing and / or sales tools.
Which means you can use this template to quickly send form data into your stack.
HubSpot's forms are often used to capture leads and their related information. This template takes advantage of the flexibility of HubSpot Forms in order to automate the addition of form fill information into any preferred service.
The key function of this template is to respond dynamically to whatever fields may be present in your HubSpot form.
All you need to do to get it working is:
Set up your HubSpot form (in the HubSpot admin UI)
Select the service you wish to send to (in your Tray workflow)
Choose the form data to be included (in your Tray workflow)
End ResultCopy
The image below shows how this template converts any submitted HubSpot form from a complex nested structure into a simple 'flat' layer of data which can then be accessed and sent to any service of your choice:
PrerequisitesCopy
This workflow assumes the following:
You can Authenticate with HubSpot and have access to HubSpot Workflows.
Workflow logicCopy
Getting LiveCopy
PLEASE NOTE: Both Hubspot and Tray.io have their own workflows in this setup. Please make sure to read the instructions carefully so you do not get confused about which service's workflow you should be referring to at each stage.
In order to configure this workflow for use, follow these steps:
For educational purposes, the rest of this page will take you through how the workflow template is built to achieve the desired results.
This will help deepen your understanding of Tray.io and will give you the power to maintain and edit your workflow as necessary.
Implementation notesCopy
Data mappingCopy
A key part of this workflow is that it can dynamically deal with any form data, whereby the fields present in one form will be different to another form.
The following screenshot shows the nested data received from a HubSpot form transformed into a simple 'flat' layer of json data that can easily be used in subsequent workflow steps:
When looping through data we need to have consistent field names to look for each time.
The issue with the form data is that each piece of response data has a different field name - i.e. "lastname", "phone", "hs_email_domain" etc.
So in order to make these consistent we convert them to key/value pairs:
So each piece of form data has the field name as the 'key' and all the rest of the metadata as the 'value'
Then, when we need to access each piece of data, we can use jsonpaths such as:
$.steps.data-mapper-1.output[0].key
$.steps.data-mapper-1.output[0].value
In this workflow the data is being looped through so the actual jsonpaths are slightly different.
First you can see that the Loop Connector is using $.steps.data-mapper-1.output
to take the whole data mapper array as its input:
Then the connector snake is used to grab the relevant data from the output schema for a single result in the loop connector.
The screenshot below shows how the 'Value' is taking the value which appears in the third layer down, hence $.steps.loop-2.value.value.value
: