> ## Documentation Index
> Fetch the complete documentation index at: https://developers.hubspot.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

---
id: d0627126-d7c2-445c-97bf-b52217e30614
---

# Build a recruiting agency website using GraphQL

> Learn how to use GraphQL to power a recruiting agency website.

export const SupportedProducts = ({marketing, sales, service, cms, data, commerce, marketingLevel, salesLevel, serviceLevel, cmsLevel, dataLevel, commerceLevel}) => {
  const translations = {
    description: "Requires one of the following products or higher.",
    productNames: {
      marketing: "Marketing Hub",
      sales: "Sales Hub",
      service: "Service Hub",
      cms: "Content Hub",
      data: "Data Hub",
      commerce: "Commerce Hub"
    },
    tiers: {
      free: "Free",
      starter: "Starter",
      professional: "Professional",
      enterprise: "Enterprise"
    }
  };
  const translateTier = tier => {
    if (!tier) return '';
    const lowerTier = tier.toLowerCase();
    return translations.tiers[lowerTier] || tier;
  };
  const products = [{
    name: marketing ? translations.productNames.marketing : '',
    level: translateTier(marketingLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/marketing-bolt.svg",
    alt: "Marketing Hub"
  }, {
    name: sales ? translations.productNames.sales : '',
    level: translateTier(salesLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/sales-star.svg",
    alt: "Sales Hub"
  }, {
    name: service ? translations.productNames.service : '',
    level: translateTier(serviceLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/service-heart.svg",
    alt: "Service Hub"
  }, {
    name: cms ? translations.productNames.cms : '',
    level: translateTier(cmsLevel),
    icon: "https://mintlify-assets.b-cdn.net/Icons/content-play.svg",
    alt: "Content Hub"
  }, {
    name: data ? translations.productNames.data : '',
    level: translateTier(dataLevel),
    icon: "https://developers.hubspot.com/hubfs/Knowledge_Base_2023-24-25/subscription_key_icons/operations_icon.svg",
    alt: "Data Hub"
  }, {
    name: commerce ? translations.productNames.commerce : '',
    level: translateTier(commerceLevel),
    icon: "https://developers.hubspot.com/hubfs/Knowledge_Base/subscription_key_icons/commerce_icon.svg",
    alt: "Commerce Hub"
  }].filter(product => product.name && product.level);
  if (products.length === 0) return null;
  return <div>
      <div className="text-sm mb-2">{translations.description}</div>
      <div className={`grid ${products.length === 1 ? 'grid-cols-1' : 'grid-cols-2'} gap-1.5`}>
        {products.map((product, index) => <div key={index} style={{
    display: 'flex',
    alignItems: 'center'
  }}>
            <img src={product.icon} alt={product.alt} className="w-3.5 h-3.5 mr-1.5 mt-2.5 mb-2.5 flex-shrink-0 align-middle" />
            <span className="font-medium mr-1 text-sm">{product.name} -</span>
            <span className="text-sm">{product.level}</span>
          </div>)}
      </div>
    </div>;
};

<Accordion title="Supported products" defaultOpen="true" icon="cubes">
  <SupportedProducts cms={true} cmsLevel="professional" />
</Accordion>

This tutorial will walk you through how to set up a recruiting agency website, showcasing how GraphQL queries can pull contact and custom object properties from the HubSpot CRM and use the data to power dynamic website pages.

All code referenced in this tutorial is available to browse in [this GitHub repository](https://github.com/HubSpot/recruiting-agency-graphql-theme). If you want to learn more about how GraphQL works and how to construct your own queries, check out the [GraphQL reference guide](/cms/start-building/features/data-driven-content/graphql/query-hubspot-data-using-graphql#query-hubspot-data-using-graphql).

Before you get started, make sure you’ve [installed the HubSpot CLI tools](/developer-tooling/local-development/hubspot-cli/install-the-cli). After you’ve installed the CLI tools, create a new directory for this tutorial. Navigate into the new directory, and run `hs init` to configure the project.

## Create and associate CRM custom objects

First, you'll need to create *Role* and *Job Application* custom objects and associate them so they can be queried from the corresponding website pages.

* Download the schemas directory from the GitHub repository and copy it into your project directory.
* Using the HubSpot CLI tools, create the two custom objects by running the following commands in the schemas directory:
  * `hs custom-object schema create job_application.json`
  * `hs custom-object schema create role.json`
* After creating both custom objects, create an association between them:
  * On the command line, run `hs custom-object schema list` to get the objectTypeId of each object.
  * Make a `POST` call using the **objectTypeId** of the *Role* object to `/crm/v3/schemas/{objectTypeId}/associations`.
  * In the body of your request, enter the **objectTypeId** of the Role and Job Application objects as the values for the *fromObjectId* and *toObjectId* fields. For example, if the objectTypeId of the Role object is 2-3206084, and the objectTypeId of Job Application is 2-3206072, then the request body would be:

```json theme={null}
// body example
{
  "fromObjectTypeId": "2-3206084",
  "toObjectTypeId": "2-3206072"
}
```

* Download the [role\_data.json file from GitHub](https://github.com/HubSpot/recruiting-agency-graphql-theme/blob/master/data/role_data.json), then populate the available roles by running the command `hs custom-object create role role_data.json`.
* In your HubSpot account, create company records for *HubSpot*, *Spotify*, and *Tesla*, then [manually associate](https://knowledge.hubspot.com/records/associate-records#associate-individual-records) each of the roles with the corresponding example company.
* Before you start creating the assets and pages for the site, download the [src directory from GitHub](https://github.com/HubSpot/recruiting-agency-graphql-theme/tree/master/src), then upload the theme to your HubSpot account by running the command `hs upload src sample-graph-ql-theme`.

## Create the job application form

After you've populated the job listings for your site, you can configure the job application form. This form will prompt users to select the role they're interested in, and submit a cover letter as part of their application.

Before you create the form, update the *Job Application* and *Role* property settings to allow the *Role identifier* and *Cover letter* properties to be used in forms:

* In your HubSpot account, click the **Settings icon** in the top right.
* In the left sidebar menu, click **Properties**.
* Click the **Select an object** dropdown menu, then select **Job Application properties**.
* Hover over the *Cover letter* property in the *Properties* table, then click **Edit**.
* In the right panel, select the **Use in forms, and bots** checkbox.
* Click **Save**.
* Click the **Select an object** dropdown menu again, select **Role properties**, then repeat the same steps to allow the *Role identifier* property to be used in forms.

<Frame>
  <img src="https://www.hubspot.com/hubfs/Knowledge_Base_2021/Developer/role-identifier-use-in-forms-checkbox-1.png" alt="role-identifier-use-in-forms-checkbox-1" />
</Frame>

* Now that the *Cover letter* and *Role Identifier* properties can be used in a form, you can create the form itself:
  * Navigate to **Marketing** > **Lead Capture** > **Forms**.
  * In the upper right, click **Create form**.
  * Select **Embedded form**, then click **Next**.
  * Click **Start** to begin creating a form from a blank template.
  * Click and drag the **First name**, **Last name**, and **Phone number** fields onto the form preview on the right to include them on your form.
  * In the left panel, scroll down and click the **Job Application properties** and **Role properties** sections to expand them.
  * Click and drag all of the fields under *Job Application Information*, along with the **Role identifier** and **Title** fields under *Role Information*, onto your form.
  * Set the *Job title*, *Role identifier*, and *Title* fields to be [hidden](https://knowledge.hubspot.com/forms/pass-contact-property-values-with-hidden-form-fields), since these fields will be auto-populated by a workflow you'll set up in the next step. When you're done configuring your form, enter a **name** for the form, then click **Update** in the top right.

<Frame>
  <img src="https://www.hubspot.com/hubfs/Knowledge_Base_2021/Developer/recruiting-agency-job-application-form-1.png" alt="recruiting-agency-job-application-form-1" />
</Frame>

## Set up a workflow for submitted applications

Now that you've created the job application form, you need to set up a workflow to define the default state of a submitted job application.

* In your HubSpot account, navigate to **Automation** > **Workflows**.
* In the top right, click **Create workflow**.
* In the left panel, on the *Start from scratch* tab, select **Job application-based**, then click **Next**.
* Click **Set Enrollment Trigger** to set the enrollment criteria:
  * In the right sidebar, under *Filter type*, select **Job application**.
  * Click **Object ID**, select **is known**, then select **Apply filter**. Click **Save**.
* Click the **+ plus** icon to create an action.
  * In the right sidebar, under *Property management*, select **Set property value**.
  * Click the **Property to set** dropdown menu, then select **Application Status**.
  * Click the **Application Status** dropdown menu, then select **Applied**.
  * Click **Save**.

<Frame>
  <img src="https://www.hubspot.com/hubfs/Knowledge_Base_2021/Developer/job-application-submission-workflow.png" alt="job-application-submission-workflow" />
</Frame>

* Enter a **name** for your workflow, then click **Review and publish**.
* Under *Enrollment*, select **No, only enroll contacts who meet the trigger criteria after turning the workflow on**.
* In the top right, click **Turn on**.

## Create role listing and detail pages

Once you've created your workflow, you can create the pages where users can view roles and submit applications for jobs they're interested in.

To create the role listing page:

* In your HubSpot account, navigate to **Marketing** > **Website** > **Website Pages**.
* In the top right, click **Create**, then select **Website page**.
* Select the **Role listing - GraphQL** template.
* In the dialog box, enter an **internal name** for the page.
* Click the **Settings** tab.
* Enter a **Page title**, then enter **roles** as the content slug.
* Click **Publish** in the top right.

With your role listing page ready to go, create the role details page:

* In the top right of the website pages dashboard, click **Create**, then select **Website page**.
* Select the **Role Details** template, then enter an **internal name** for your page in the dialog box.
* Select the **Role details - GraphQL** template, then enter an **internal page name** in the dialog box.
* Click the **Settings** tab.
* Enter a **Page title**, then enter **roles/role** as the content slug.
* Click **Publish** in the top right.

## Create applications page

With your role pages published, the next step is to create a page where an applicant can view their submitted applications and check on the status of each one.

Since this page will be private to each applicant, you'll need to create a membership list to handle registration. Learn more about how membership works in [this article](/cms/start-building/features/memberships/overview).

To create the membership list:

* In your HubSpot account, navigate to **Contacts** > **Lists**.
* In the top right, click **Create List**.
* Enter a **name** for your list, then click **Next**.
* Click **+ Add filter**.
* In the right panel, configure the filter:
  * Select **Job Application properties**.
  * Click **Object ID**.
  * Under *Object ID*, click the **dropdown menu** and select **is known**.
  * Click **Save Group**.

<Frame>
  <img src="https://www.hubspot.com/hubfs/Knowledge_Base_2021/Developer/list-membership-job-application-filter.png" alt="list-membership-job-application-filter" />
</Frame>

* In the top right, click **Save list**.

When a job application is submitted, the associated contact will automatically be added to the list you created. You can now create the application listing page and the application details page.

To create the application listing page:

* In your HubSpot account, navigate to **Marketing** > **Website** > **Website Pages**.
* Click **Create page**, then select **Website page**.
* Select the **Application Listing - GraphQL** template.
* Enter an **internal name** for your page.
* Click and drag the **Existing Application Listing** module into your template.
* Click the **Settings** tab.
* Enter a **page title**, then enter **my-applications** for the content slug.
* Scroll down and click **Advanced options** to expand the section.
* Under *Control Audience Access for this page*, select **Private - Registration required**.
* Click the **Select lists** dropdown menu and select the membership list you created.

<Frame>
  <img src="https://www.hubspot.com/hubfs/Knowledge_Base_2021/Developer/job-application-listing-membership-settings.png" alt="job-application-listing-membership-settings" />
</Frame>

* In the top right, click **Publish**.

To create the application details page:

* Back on the website pages dashboard, click **Create**, then select **Website page**.
* Select the **Application details - GraphQL** template, then enter an **internal name** for the page.
* Click and drag the **Application Details** module into your template.
* Click the **Settings** tab.
* Enter a **page title**, then enter **application-details** for the content slug.
* In the top right, click **Publish**.

## Edit website header and menu items

The final step is to finalize the website header and create a menu that links between each of the pages. All of the application and role pages share a header, so you can edit the global module and the changes will apply to each of the pages.

* On the website pages dashboard, hover over one of the pages you created and click **Edit**.
* Click the **website header**. In the dialog box, click **Open in global content header**.
* In the left pane, click the **Content** tab, then click **Primary navigation**.
* Click **Edit**.
* Add two new menu items:
  * Click **Add menu item**, then select **Add page link**.
  * Enter **Roles** for the *Menu item label*, then click the **Select page** dropdown menu and select **Roles listing page**.
  * Repeat the same steps to add a menu item for the application listing page.
* Click **Publish**.

<Frame>
  <img src="https://www.hubspot.com/hubfs/Knowledge_Base_2021/Developer/updated-agency-navigation-menu.png" alt="updated-agency-navigation-menu" />
</Frame>

With your menu updated, your recruiting agency website is ready to go.

To test out the site, open a new incognito window and navigate to the URL of the role listing page. You can submit an application for a role and confirm that the associated application appears on the application listing page you created.

If you want to review the GraphQL queries that power this example site, you can find them in the *data-queries* directory of the GitHub repository or you can navigate to the *sample-graphql-theme* in the design manager.

To learn more about GraphQL, check out the reference documentation [here](/cms/start-building/features/data-driven-content/graphql/query-hubspot-data-using-graphql#query-hubspot-data-using-graphql).
