Customize your API requests and responses using Workflow scripts
prescript
function runs before sending requests to your API. Use it to modify request parameters, add headers, or transform data.
async
functions, for example: async function prescript(request) { ... }
.postscriptV2
function processes API responses before displaying them. Use it to transform response data or extract specific fields:
undefined
if the variable is not found in the current context.
require
or import
to use these modules in scripts. These are directly available in the script environment.axios
: Axios is a popular HTTP client library for JavaScript. It provides a simple API for making HTTP requests and supports various features like request and response interceptors, request cancellation, and automatic JSON parsing.fetch
: Fetch is a modern web API for making HTTP requests in JavaScript. It provides a promise-based interface for fetching resources and supports features like streaming, request/response customization, and automatic JSON parsing.