For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom scripting

Introduction

Typically, transform functions are used to change data as it moves through a process flow. However, if your requirements are more complex than standard transform functions can handle, custom scripting is the answer.

With Patchworks custom scripting, you write and maintain scripts centrally — in our proprietary script editor — then use them wherever they're needed throughout the platform. From a single build & test workspace you can code by hand or build with AI, test with realistic inputs, then version and deploy your scripts — with full visibility of where each one is used.

Script types

Every script is created as one of six types. The type sets the starter template you begin from, and the inputs/outputs the script is written against — so you always start from a shape that matches the job:

Script type
Typical use

General

Runs as a step in a process flow, transforming the payload passed to it — via the script shape or the map shape's script transform function.

Pre-auth

Prepares an authentication request before it's sent — used with connector builder authentication methods.

Post-auth

Processes an authentication response — for example, extracting and shaping tokens for subsequent requests.

Pre-request

Adjusts a connector endpoint request before it's sent.

Post-request

Processes a connector endpoint response before it's passed on.

Pagination

Implements custom pagination logic for connector endpoints.

The script type is a guide, not a restriction. It determines the starter template and the inputs shown when you're building and testing, but it doesn't limit where the script can be attached.

Supported languages

You can create scripts in any of seven coding languages: C#, Go, JavaScript, PHP, Python, Ruby and Rust.

When you create a script, you choose the language and a runtime version (for example, Node 24 for JavaScript) — the versions currently available for each language are shown in the runtime version dropdown. The runtime version can be changed at any time, but the language is locked as soon as you save your first version of the script — so choose carefully!

Supported libraries & packages

All of our coding languages are supported with default packages. In addition, the following libraries/versions are included:

Language
Additional libraries

JavaScript

jsrsasign (^10.8.6), xml-js (^1.6.11)

Python

requests (2.32.3)

PHP

phpseclib (~3.0), bcmath, SSH-2.0, PDO_MYSQL, phpSpreadsheet

C#

System.Xml.ReaderWriter, Newtonsoft.Json

If you want to use a library that isn't included by default, you can embed it directly in your script, or contact Patchworks support to request it.

AI assistance

You don't have to write scripts yourself! The script editor includes an integrated AI script assistant — switch the editor into AI mode, describe what you need, and a draft script is generated for you. The assistant knows about expected inputs and value types (payload, metadata, variables and flow variables), so generated scripts are in a form that's ready to use. See Creating a script with AI.

Scripts can also be created conversationally via the implementation agent — useful when a script is just one part of a wider build.

Versions & deployment

Scripts are versioned — each script can hold up to 10 versions, and saving is separate from deploying:

  • Save work-in-progress versions as often as you like, without affecting anything that's live.

  • Deploy a version when you're ready to release it — and update every process flow that uses the script in one action.

See Deploying scripts & managing versions for more information. All changes and deployments are recorded, so you have a full audit trail of who changed what, and when.

Learn more

To get started with custom scripts, see the pages below:

Last updated

Was this helpful?