The Workflow Library

Library / Renewal and expansion / renewal-expansion-044

Custom code action pulls usage API data into risk score property

Renewal and expansionCompanyData Hub ProfessionalAdvanced~55 min to buildFull spec

Outcome. Every customer account gets a fresh usage-based risk score pulled directly from the product's usage API on a recurring schedule, instead of depending on a separate integration tool to sync that data into HubSpot first.

Workflow map Enrollment, branches and actions at a glance renewal-expansion-044
flowchart TD
    A[Scheduled daily run: Customer accounts with External Account ID] --> B[Custom code: call usage API, compute risk score]
    B --> C{Call succeeded?}
    C -->|Yes| D[Set Usage Risk Score and Usage Last Synced At]
    C -->|No| E[Notify operations owner: pull failed]
action or delay branch public on every spec, paid or not

When to use it, when not to

  • UseUse it when the product's usage data lives behind an API the team already has credentials for, and no dedicated sync integration exists (or is worth building) to bring that data into HubSpot as a standing property.
  • UseUse it as a lighter-weight alternative to a full third-party integration, for a portal that only needs one or two usage-derived numbers rather than a complete two-way sync.
  • SkipDo not use it if a proper native integration or iPaaS connector (a dedicated app, or Zapier/Make) already keeps usage properties current; a custom coded action calling the same API on a schedule duplicates that work and adds a second point of failure.
  • SkipDo not use it for real-time usage alerting; a scheduled pull is only as fresh as its run interval, typically daily at best for this pattern, not instant.
The preview ends here. Six sections are in the library. counted, not blurred
PrerequisitesEvery property with its label, internal name, type and options, plus the assets the workflow needs before you start.5 items
EnrollmentThe trigger, the criteria exactly as they are ticked in the UI, the re-enrollment rule and the suppression list.4 parts
StepsEach action in order with its parameters, its branches and its delays, written as you tick them.6 numbered actions
Known pitfallsTraps seen in production, each with what breaks and what to do instead.5 pitfalls
Test plan, variants and build specHow to prove it works in a test portal, where to look when it does not, the variants for other objects or tiers, and the YAML build spec.3 variants, 3 sections
FilesThe properties JSON creates the fields in one API call, the workflow JSON documents the build, and the custom coded action ships as a ready-to-paste .js file.PDF, Markdown, JSON, code
Install1 click. The installer creates the properties this spec declares and the workflow itself, switched off, then opens a task for the prerequisites that are assets rather than properties, such as a team, a static list or a marketing email. What it created is listed on the install page.1 click, switched off
Unlock the full library, 149 EUR

or the renewal and expansion pack, 39 EUR

One-time, excl. VAT. 30-day refund, no questions asked. Founding prices until 31 October, then 199 and 59 EUR. Includes every spec added later, up to the full 500, and the one-click installer on the full library. Building on client portals? The agency licence at 449 EUR covers unlimited client portals.