Run Custom Code

System snippet library

Ready-made, production-tested snippets for the Run Custom Code action. System snippets are read only: open the Snippets page in your dashboard and clone one into your own snippets, then customize the copy. Each snippet documents its inputs, required secrets and outputs.

Inputs map to the action's Input 1 to Input 5 fields. Secrets are added once on the Secrets page and referenced in code as secrets.NAME. Outputs come back as Output 1 to Output 5, usable in later workflow steps.
Loading the library…

Frequently asked questions

Can I edit a system snippet?

No. System snippets are read only so they stay stable for everyone. Clone one into your own snippets and edit the copy, which is yours to change freely.

How do I use a snippet in a workflow?

Clone it from the Snippets page in your dashboard, then add the Run Custom Code action in any HubSpot workflow and pick your copy from the Select Snippet dropdown.

Do snippets need secrets?

Some do. Each snippet lists the secrets it requires, for example a HubSpot private app token or a Slack webhook URL. Add them once on the Secrets page and reference them in code as secrets.NAME.

Which plan includes the snippet library?

The library is available with the Run Custom Code action, which starts on the Starter plan.

Want a snippet that is not here? Tell us the use case and we will consider adding it to the library.