Playbook ยท CRM operations

HubSpot custom code workflows

Sets up HubSpot custom code workflow actions, from the private app, scopes and secrets to inputs and outputs, platform limits, testing and the common use cases.

Use this when

You are hitting the limits of native HubSpot workflows, such as bulk associations, renewals, scoring and external API calls.

Tools in this playbook

  • HubSpot
  • Clay
  • Slack

The workflow

How it works

  1. 01

    Create a private app

    We create a private (legacy) app in HubSpot settings and store its access token securely.

  2. 02

    Configure scopes

    Only the scopes needed are granted: contacts, companies, deals and custom objects.

  3. 03

    Add the custom code action

    We add a Custom code action to a workflow, link the app and store the token as a secret, never inline.

  4. 04

    Define inputs and outputs

    We map the input properties and declare the outputs, at most 25 and all returned as strings, so objects are flattened.

  5. 05

    Write the code

    The code follows a read inputs, run logic, callback structure within the platform limits: bundled packages only, a 20 s timeout and 128 MB of memory.

  6. 06

    Test before activating

    We test against a real record and confirm the outputs match what the downstream actions expect.

  7. 07

    Apply to common use cases

    Typical uses are bulk associating and dissociating records, copying line items to renewal deals, ICP scoring on enrolment, calls to a Clay webhook for enrichment and Slack webhooks.

Run this playbook in your systems

We build it into your stack and run it for you. Start with a free strategy call.

The workflow: HubSpot custom code workflows