Serverless Functions in HubSpot: What You Need to Know
05/14/2020 • 3 min read • Written by Corie Stark
In case you missed it, last month, HubSpot unveiled its updated content management system, CMS Hub. This new product comes in two editions – Professional and Enterprise – and houses tons of features that make building and creating websites easier for both your marketing department and developers.
While we’ve already gone over how some new elements, like CMS Hub Themes, benefit marketers, we haven’t touched on what updates will impact your development team. Developers are already familiar with building projects on HubSpot, so you may be wondering: What’s different for them in CMS Hub Enterprise?
The full answer? A lot. But what we want to focus on in particular that your development team should be excited for: Serverless functions! This new feature is available on CMS Hub Enterprise and can be used in a variety of ways. Here’s a deeper look.
What Are Serverless Functions?
Serverless functions use resources provided by a cloud provider rather than resources on a dedicated server. This significantly expands what a developer can do within HubSpot because they no longer have to set up scripts on an external server. Instead of going through atypical developer operations tasks, like purchasing a virtual personal server (VPS) and installing an operating system, now, all a developer has to do is write code.
Additionally, serverless functions offer a way to write server-side code that interacts with HubSpot or another third-party service through the use of an API. APIs requiring authentication can potentially expose your credentials to end-users, but serverless functions act as an intermediary to keep those credentials safe. When your developers use serverless functions, they won’t need to deal with the overhead associated with managing a server, which will give them more opportunities to build cool functionality.
So, What Are Some Common Uses?
Serverless functions can be used for multiple purposes, but some ideas to quickly get up and running with them include:
- Allowing user actions to make updates in the HubSpot API, such as:
- Updating a HubDB table based on a form submission or other action
- Manipulating contact properties without requiring form submissions
- Getting specific details for another contact, deal, or another object from the HubSpot API
- Forwarding a request on to a non-HubSpot API service without exposing credentials. More details:
- Secrets are stored server-side, so they never touch the user’s browser
- You can filter the things a user can do down to just the actions you want to allow
- Specific instances where you might do this: event calendars, signups using a third-party service, integration with various Google APIs like Maps, and social media share counts.
- Hiding things from the user’s browser. An example:
- Say you have a custom calculator module. Before using serverless functions, all of your code (including whatever math you’re doing) likely lived in client-side scripts, where a knowledgeable user could trivially deconstruct them and see how the calculator works. If you didn’t want that math to be public, that could be problematic. If the results are calculated in a serverless function, that’s not possible.
- Integrating with CMS Memberships. For instance:
- The scripts, by default, know if the current user is logged in and who they are, so you can write serverless functions that are gated via CMS Memberships. If you have a member portal where users can see and edit details of deals they’re attached to, you can write your script, so they only see the deals they’re authorized to modify.
Other Important Considerations Regarding Serverless Functions
Serverless functions help reduce the number of systems your company depends on. If you have a website on HubSpot and some vital script on some third-party platform, you’re relying on both of those to not go down. If your script is a serverless function instead, you only depend on HubSpot.
In a similar vein, serverless functions make your developers’ lives easier by keeping a complex project all within the HubSpot ecosystems. Your developers don’t have to go to a separate platform to manage server-side stuff, and it’s easier to edit client-side and server-side scripts in the same place. But before your development team goes running off to use serverless functions, there are a few limitations to be aware of, as noted from HubSpot:
- 50 secrets per account
- 128MB of memory
- 10 seconds of execution time
- 60 function executions per minute
- 600 seconds (10 minutes) of function execution time per minute. This means that in a single minute, 60 functions that complete in 10 seconds could run OR 600 function executions that complete in 1 second could run.
- No more than 100 endpoints per HubSpot account
Get Started
Serverless functions open up a world of possibilities for your development team, making them one of the slickest new features of CMS Hub Enterprise. For more information on CMS Hub, keep an eye out for future blogs. If you want to discuss serverless functions more in-depth, reach out today!
By: Corie Stark
After spending many years as a sports journalist, Corie switched to marketing in 2013. Her love of writing, talking to people, and keeping up with the industry enables her to use her skills for anything from social media to long-form blogging. Outside of work, she enjoys hiking with her dogs and making her cats chase the ever elusive red dot.
You May Also Like
HubSpot
2023 HubSpot INBOUND Product Updates & Features Recap
Learn about HubSpot's INBOUND 2023 releases. Explore groundbreaking features like AI-driven CRM, Commerce Hub, and tailored U...
Keep ReadingHubSpot
HubSpot Free CMS: What You Need to Know
Explore the capabilities of CMS Hub Free, HubSpot’s newest tier of its content management system.
Keep ReadingHubSpot
CMS Comparison - Comparing HubSpot to Wix & SquareSpace
Decide if HubSpot's new CMS Hub is right for your organization by taking a look at a comparison of it versus two popular comp...
Keep ReadingSubscribe Today