Trigger webhook by form submit


#1

Hi!
Newbie here..
So, I'm trying to trigger my webhook, by using a form submission.
As I've understood it's not possible to trig by for example "num_conversion_events", meaning when the form submission count changes.
Is it any way to do this without using work flows?

Thankful for any help and hints!

Edit:
Just saw this on the hubspot academy
"Posting HubSpot contacts data to another system, such as a CRM, when that contact fills out a particular form on your site."

Ok but how.. ? The webhook should be a POST i assume? But how do I know which data will be posted?


#2

Hi @newbie,

It's not really possible to trigger a webhook based on a form submission. Generally, if you care about information that's updated by a form submission, best practice is to subscribe to the property change events for those specific properties. Can you give me some more information on what exactly you're trying to accomplish? There might be other ways to accomplish your goal.


#3

Hi @Derek_Gervais
Thanks for the reply.

What I'm looking to do is to create a new lead in CRM based on some specific actions/preferences.
For example: Form submission + Lifecycle Stage == Sales Qualified Lead, Opportunity, Customer,
Evangelist --> New lead in CRM

I've tried to create a workflow with the following:
"Enrollment triggers - Contact has filled out [Form name]
AND
The contact property Lifecycle stage is equal to any of Sales Qualified Lead, Opportunity etc."
This is set to trigger a webhook..

Will this not work?


#4

Hi @newbie,

Yes, that should work, but that uses workflows. I was under the impression that you were looking for solutions that didn't involve workflows, but if you have access to them then that's the best way to accomplish what you're looking to do. Here's the doc on workflow webhooks:


#5

Hi @newbie

You can trigger a Web Hook on Property Change (changed by a form submission) by creating an "App" with a Webhook Subscription.

If you have a property (hidden or unique to your form) you can set a "Webhook Subscription" that triggers a Webhook when the property changes. This works for Contacts, Companies or Deals.

For example we've built an App, for a client of ours, that logs changes to a spreadsheet. When key properties are changed in Companies or Contacts the administrator can double check the changes in the spreadsheet.

Here's more information: https://developers.hubspot.com/docs/methods/webhooks/webhooks-overview

A creative alternate...

Can you use a Callback in the Form Embed Code?

When the HubSpot Form is submitted you can add a JavaScript Callback using the onFormSubmit.

Here's more information: https://developers.hubspot.com/docs/methods/forms/advanced_form_options

Feel free to get in touch if you have more questions.
Mike


#6

Hi @Derek_Gervais, Thanks for your reply!
Yes, that was my inital thought, but after realizing it wouldn't work without a workflow I decided to create one.
Bumped into some other issues though..

At this point the workflow is set up like this: (made som adjustment to it since my first post)
Enrollment trigger;
"Contact has filled out [Form name]"
And this is supposed to trigger a webhook.

But! The issue is...
If a non-existing customer fills out the form - a contact is created and the webhook is triggered.
And if I manually create a contact, and this contact at some point fills out the form the webhook is triggered - but only once!
If a contact fills out the form more than once the webhook isn't triggered.
Is it possible to have the webhook triggered for anyone who fills out the form, no matter on the number of form submissions?


#7

Hi @Webalite !
Thanks for replying! :slight_smile:

I've spend hours and hours reading the instructions but unfortunately I'm still a bit lost.
Please see my response above to Derek about how I want my webhook to be triggered, do you think it would be possible to solve with a webhook subscription instead?

I'm not sure about a callback, I have to look into it a bit further.


#8

Hi @newbie

At this stage I have more questions than answers – do you want to jump on a call?

Mike


#9

Hi @newbie,

You should be able to set the form submission criteria up for automatic re-enrollment. Can you send me a link to your workflows page in HubSpot and I'll take a closer look?


#10

Thanks @Derek_Gervais , I sent you a PM.
Bumped in to another issue though..
My webhook at the workflow is set to POST. And the output of that post does not contain any information from the form. I can always make a get of the VID of the contact, to get the phone number and so on, but my issue is the free text field. Is it possible to get that information in the output payload?


#11

Hi @newbie,

Workflow webhook POSTs send the full JSON data of the contact in the workflow, not the form submission that triggered the workflow. The form field you want should correspond to a particular contact property, which you should be able to parse from the POST body. Otherwise, you're right that you'd need to request the contact using the vid.


#12

Hi @Derek_Gervais thanks for replying!
Ok, do you know whichparticular contact property it would be? I seem to be unable to find it.. :confused:


#13

Hi @newbie,

I don't for your specific case, it depends on the form you're working with and the contact property you care about. For example, if I have a form that has the following fields:

  • First Name
  • Last Name
  • Email
  • Phone Number

The fields would (more than likely) correspond to the following contact properties:

  • firstname
  • lastname
  • email
  • phone

If I had set up a workflow to enroll contacts who had filled in this form, and to send a POST webhook to my server, I would then see something like this hit my server:

By parsing that JSON, I can then pull out the firstname, lastname, email, and phone properties to use in my external system. Since the webhook payload will contain every contact property for which a contact has a value, you should be able to find any property by parsing the webhook JSON.


#14

@Derek_Gervais Thanks for the reply!
Yes, thats almost exactly what I'm doing, but I also use the "free text field".. Where the person visiting the webpage can leave a message of their choice. So what I'm looking to do is get that text from the free form also sent with the POST webhook along with the first and last name and email and so on.. Is that possible?
And can I also see the free text field entry in Hubspot somewhere?
Br,


#15

Hi @newbie,

Can you send me a link to the form you're using in HubSpot? It's tough to give specific answers in the abstract.


#16

Hi @Webalite ,
Sorry for a late reply. Been too busy trying to solve the issue.
Just have a few small issues remaining at this point, but thanks, I really appriciate your help! :slight_smile: