Here’s the problem: A client of ours has many gated whitepapers on HubSpot, and they wanted to group them into pages where each page contains the related whitepapers, by topic. So, in essence, the HubSpot landing page consists of a simple lead generation form which, at the end, contains a checkbox list consisting of whitepaper names that belong to similar topics. What the client wanted was to 1) allow the users to automatically download all the selected whitepapers when they click on the “Submit” button on the HubSpot form, and 2) send them an email containing the list of the whitepapers that they have just downloaded and where they can download them again (e.g. a list of whitepaper title/link).
At first glance, what our client wanted seemed impossible, but, after analyzing their request, we broke it down to 2 possible tasks (still complex, but not impossible):
1- For the automatic download on submit, we leveraged the onFormSubmit HubSpot event (which we have used before for creating a multi-step form in HubSpot), where we sent, through AJAX, the request to a PHP script on one of the client’s servers, which processed the request by generating a zip file containing the PDFs that the client selected, and then pushed the zip file back to the browser as a download.
2- For the email, we created a workflow which triggered a webhook on one of the client’s servers, and the latter was responsible for sending the email to the lead.
Of course, the big question is how we made it generic? Well, at first, we didn’t as the client had a preset list of whitepapers to be included on each page. But then, when the client wanted to modify the lists, we knew that the best option would be to make it generic rather than fiddling with the code each we wanted to add/delete a whitepaper.
So, again, how did we make it generic?
Well, first we ensured that each option in the checkbox list had a value that is the name of the campaign of the associated HubSpot form. Then, in both of our processing scripts (the one that handles the automatic download and the one that handles the email sending) we grabbed the title of the page and the associated PDF file for each campaign by searching in the HubSpot page dump.
We hope that you found this post useful and fun (implementing this feature and writing about it were both fun for us). If you need help with the implementation, then please contact us. Our rates are right, our work is top notch, and we just adore HubSpot!