Use Double Opt-in with the Forms API


#1

Hi,
we have created a Hubspot form to allow our users to subscribe to our newsletter, and that form is linked to a Hubspot landing page. Double opt-in is enabled for that landing page, so when we navigate to that page directly in the browser and submit the form from there, everything works as expected, a new contact is created and a transactional email is sent so it can confirm the subscription.
However, when we try to collect the data in our own form and send it to the hubspot form via the Forms API it doesn’t work, because the contact is created but the email is not sent. We have tried to include the URL of the landing page in the hs_context param, but that doesn’t work either…
Any ideas on what the problem might be?

Thank you!


#2

@josepBG Are you using a workflow to send the email? If so what is the enrollment criteria?


#4

Hi @pmanca, we aren’t using any workflow, the landing page is just included in the ‘Enabled for some pages only’ option in the Double Opt-In section, and the confirmation email is sent automatically when the form in that page is submitted:


#5

@josepBG Can you provide me an example contact of one that did work and one that didn’t work?


#6

@pmanca The problem is not in the contact, but rather in the method used. If the form is sent directly from the landing page it works everytime, but it doesn’t when the form is sent through the Forms API endpoint.


#7

@josepBG Just so we are clear you made a custom form on the HubSpot landing page and you are using the forms API?


#8

@pmanca Exactly. We use the Forms API because we already have a form in our website with our own design, and don’t want to send the user to a different page.


#9

@josepBG One option would be to use the HubSpot Forms on a HubSpot Landing Page and then you could use a workflow to send out a webhook of the contact who submitted that form to your other system. Since our APIs do not allow CORS requests you will have to send the data from your custom form to a proxy server to relay it to the forms API and cannot make a call directly to the Forms API from a HubSpot Landing Page.