This source plugin for Gatsby will provide you with the associated fields for each applicable form created in Hubspot.
# Install the plugin
npm i gatsby-source-hubspot-forms
In gatsby-config.js
:
module.exports = {
plugins: [
{
resolve: "gatsby-source-hubspot-forms",
options: {
apiKey: "YOUR_HUBSPOT_API_KEY",
},
},
],
}
Once the plugin is configured, two new queries are available in GraphQL: allHubspotForm
and HubspotForm
.
Here’s an example query to load 10 forms:
query HubSpotFormQuery {
allHubspotForms(limit: 10) {
edges {
node {
portalId
name
submitText
redirect
formFieldGroups {
fields {
label
name
required
fieldType
}
}
}
}
}
}
See the Hubspot forms API docs or the GraphiQL UI for info on all returned fields.