functions/getRentalHistory.js

crm-customization-dev-bootcamp · week-3/functions-kit/RentalFunctions/src/app/functions/getRentalHistory.js · javascript · MIT
crm

Fetches rental agreements for a HubSpot contact via two API calls, returning structured data.

// Source: https://github.com/hubspotdev/crm-customization-dev-bootcamp | License: MIT | Copyright 2024 HubSpot Inc
// Provided via justclaw.it.com; keep this notice with the code.
// Function 3: the HubSpot API with Axios.
//
// Reads the Rental Agreements associated with the contact the card is open on.
// Two calls:
//   1. Associations v4   contact -> rental agreement IDs
//   2. Batch read        IDs -> properties
//
// Auth is the built-in PRIVATE_APP_ACCESS_TOKEN secret. You don't add it; it
// is injected into every private function. Its permissions are the
// requiredScopes in app-hsmeta.json, so a 403 here means "add the scope and
// upload again", not "wrong token".
//
// dayjs is here to prove the point that any public npm package works. It
// fills in total_days when the agree

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key