Autofill With Form API

forms

#1

Hi,

I currently have a form that I created using HTML and CSS, and then linked to HubSpot through HubSpot’s API.

This is working great, but I am wondering if there is a way to auto-fill the form fields with known contact information, similar to how you can if you embed a HubSpot form using their JavaScript.

Thanks for any help!
Ryan


#2

Hi @heyryanleys,

This is possible however it will require a bit of development work. Keep in mind this all must be done on the server side as we do not support cross origin requests.

  1. In your page handler, you can check out the hubspot cookie (or UTK) and see if HubSpot has any information on the visitor via this endpoint
  2. You can parse this information for the fields you need then populate the HTML of your form with the values provided.
  3. Then you can serve up that form with the values pre-populated.

Let me know if you have any questions.

-Zack


#3

Hi @zwolfson,

This is funny, I think I may have spoke with you once about an issue I was having where I needed multiple unsubscribe pages for different countries. If so, thanks! That was a big help.

For this I ended up just using an embedded HubSpot form and restyling it instead of using my own form, but in the future I’ll think about doing it this way!

Best,
Ryan