APIs & Integrations

TDwebdev
Contributor | Diamond Partner
Contributor | Diamond Partner

Submited forms POST to a third party API via module

Hello,

 

What is the best way to send submited data from a form in HubSpot to a third party API from a customer(without a extra platform/webserver)?



Vet Digital

Did my post solve your question? Help the community by marking it as a solution
0 Upvotes
2 Replies 2
piersg
Key Advisor

Submited forms POST to a third party API via module

HI @dennisedson, you took the words from my fingers, as it were. Sending data via POST usually requires some form of authentication, which you can put in your client side JS but I would advise against it for security reasons. Google Cloud functions and AWS Lambda both have free tiers (up to 2 million and 1 million/month executions respectively, and some number of GB-seconds that I can't remember).

 

As @dennisedson has said, generally speaking using the Hubspot Form methods like onFormSubmit would work well for this, alternatively using the Hubspot Form message event

 

window.addEventListener('message', event => {
  if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
    // do something (you could also add the form id in the above if statement if you want it for a specific form)
  }
});

 

We need more info on the API you want to use to be able to provide more specific help.

dennisedson
HubSpot Product Team
HubSpot Product Team

Submited forms POST to a third party API via module

Hi @TDwebdev 

Might need more details on  the the third party API.  For one, does it require some form of authentication such as an API key?  If so, some form of middleware may be necessary.  There is an onformsubmit callback function that might be of use to you here.

@piersg what are your thoughts?