Skip to content

HubSpot/cms-custom-objects-example

Repository files navigation

CMS Custom Objects Example

This project demonstrates how custom objects can be used inside the HubSpot CMS.

Sign up to the beta (REQUIRED)

To try this custom objects example you'll need access to some beta functionality. Specifically you'll need to participate in our CRM objects in CMS and CMR Object Field betas.

The sign up form requires a password, as this was announced as part of Developer Day our resources page contains the password at the bottom of the page. Sign up for these betas and more

Getting started

Before getting started, you'll need an account that has CMS Hub Enterprise and access to the API Key.

  1. Clone this repo to your machine
  2. Install dependencies via npm install
  3. If you already have a hubspot.config.yml file set up, you will need to run hs auth and generate a new personalaccesskey that includes the "Custom Objects" permission. Otherwise, run hs init to set up your config file. Make sure to include the "Custom Objects" permission. More info on setting up the config file can be found here.

image

  1. Run npm run setup to create the custom schema and custom object
  2. Copy the API key for your portal from HubSpot API key. You will need to create one if you haven't already. More info on API Keys can be found here.
  3. Add your API key by running hs secrets add APIKEY <apikey> using your API key from step 5. This will allow the serverless function used when submitting the form to make authenticated calls.
  4. Create a form that contains the following fields:
  • First Name
  • Last Name
  • Email Address
  1. Upload the hub-homes folder from the repo to your portal by running npm run upload
  2. Create a website page that will display property details by using the "Details page" (details.html) template. The slug for for Details page must be /property; you can change the content slug under the page's settings. Additionally, in the "Property Details Module", you'll need to choose the form that you created in step 7.
  3. Create a website page that will display all property listings by using the "Home page" (property-listings.html) template
  4. View the newly created page from step 10.