We have a HubSpot form that we embed into a fleet of WordPress marketing sites. Upon submission of this form we want the data entered within that form to be sent to a RESTful API endpoint that we control. For example, if the form has a single text input called name upon submission of the form we would like the nameto be sent to an endpoint like https://api.baseurl.com/api/v1/form which accepts a POST request
Method #1
To accomplish this I have created the following pieces
1. The form itself, and
2. A workflow that triggers on submission of the form, and
3. A WebHook action on the workflow that invokes this endpoint
Upon submission of the form I see the workflow does execute and the webhook action does invoke our endpoint.
The endpoint originally Accepted multipart/form data.After reading through this forum I see that it should accept an application/json body. So I changed the endpoint to Accept application/json and retriggered it. I also increased logging so that I can see the entire request as it comes in. While there is a request that comes in the body doesn't look to contain any of the fields on the form?
Method #2
Because I could not get Method #1 to work I also attempted to modify the form so that it redirects not to a thank you page but rather redirects directly to our endpoint. Upon submission of the form I see that it does invoke our endpoint but it only sends a query parameter called submissionGuid. I wrote some code to take that submissionGuid and try to retrieve the data from the /form-integrations/v1/submissions/forms/:guid however apparently the guid it's expecting is the form guid not the submission guid. I can't find an endpoint that accepts that submission guid and returns the response.
Can someone please help me here. I feel like this shouldnt be so difficult
Any help would be greatly appreciated. I'm starting to get frustrated because we'll work through a solution only to realize its a dead end. I am simply trying to post the form data to another location. I must be doing something wrong because this should be the easiest thing to do with a form