Call an internal API with a signed JWT

Store the signing key as a secret, build the JWT in code with crypto, and post with axios.

The challenge

Internal services usually expect a signed token rather than a static key, which HubSpot's native actions cannot produce. The usual workaround is a middleware service that exists only to sign requests.

How AuPerate solves it

Build the token in the workflow with the crypto library, with the signing key held as an encrypted secret, then call your endpoint directly. No middleware to run or secure.

How to build it
  1. 1Store the signing key as a secret in your dashboard, never in the code itself.
  2. 2In Run Custom Code, build the token with the crypto library and reference the key as secrets.YOUR_KEY.
  3. 3Post to your endpoint with axios inside the same snippet.
  4. 4Return the response fields you need as Output 1 to Output 5.
What the action gives you
  • Saved, versioned snippets or inline code
  • Encrypted secrets injected as secrets.KEY
  • axios, lodash, dayjs, crypto and form-data available
  • Console output captured for debugging

Build this in your own workflows

Install AuPerate once and every action appears in your HubSpot workflow editor.

Get Started