I am trying integrate an API into our website, but am running into some trouble with the POST request.
I have a form that is collecting data that I then need to send to the API in a post request. I would like this request to trigger upon submission of the form. I see that there is a fairly easy way to implement this via webhooks. We however do not have Operations Hub Pro and so do not have access to webhooks.
We would prefer to not have to upgrade our account in order to implement this API. Is there a way to implement this without webhooks?
@TMcMillan5 - It’s hard to give you the best advice without knowing more about the context of what you are trying to achieve. But here are a few thoughts on getting form data into HubSpot:
- Use a HubSpot form and integrate directly in your site using the embed script thats part of a form definition. I’m going to assume you may have moved beyond this option for some reason, but there are not many downsides in practical applications.
- Use a “synthetic” form submission - an API call that simulates a form submit and transfers the data just like the native form woud process it, incuding marking a form event on the contact timeline. The documentation for this API is at: Accounts Dashboard | HubSpot
- Use some other JS on your site that is triggered by a submit action and code a indirect Contact API call in the thread of that JS code. The challenge is executing the API call in a context other than the client side code, where authentication becomes problematic. Often this requires creating a proxy the sits inbetween the web site and HubSpot.
I agree with @SteveHTM’s suggestions and would like to add to the last point about using JS - you could use the “onBeforeFormSubmit” event to execute a serverless function right before the form submits, which would allow you to make an API call without having to do authentication on the client side code (it would be done in the serverless function). However, it might not be the most reliable option and would require Content Hub Enterprise - but an option nonetheless.