Third-party modules are open-source JavaScript libraries that integrator.io bundles into its JavaScript runtime. You don't install them or manage their versions — add an import statement at the top of your script and call the library's functions. Use them for work the JavaScript language doesn't handle on its own, such as cryptographic hashing or date arithmetic.
This section covers the libraries integrator.io supports and how to call them from a script.
Supported libraries
| Library | License | Supported version | Use it for |
|---|---|---|---|
sjcl |
BSD-2 | 1.0.8 | Encoding, decoding, and hashing values |
dayjs |
MIT | 1.11.0 | Parsing, validating, manipulating, and displaying dates and times |
Features from other versions of these libraries aren't available.
Import a library
Add the import statement as the first line of your script. integrator.io resolves the library when the script runs.
import sjcl from 'sjcl'
import dayjs from 'dayjs'
Some libraries ship optional plugins you import separately. For example, dayjs quarter calculations require the quarterOfYear plugin:
import dayjs from 'dayjs' import quarterOfYear from 'dayjs/plugin/quarterOfYear' dayjs.extend(quarterOfYear)
Limitations
- The JavaScript runtime module doesn't support
dayjstimezone. -
sjclanddayjsare the only libraries available in the JavaScript runtime. To use another library, host your code as a stack on your own server — either an Express-based app or an AWS Lambda extension — and call the stack from a hook or wrapper. See Create and manage stacks.
Where to call these libraries
Call them anywhere you write a script, most commonly inside a hook that processes records. The JavaScript hooks article explains the available function stubs; select the stub that matches the point in the flow where you want the logic to run, then add your library calls inside it.