Instructions for using custom code actions in workflows
require()
function at the top of your code.
@hubspot/api-client
: ^10
async
: ^3.2.0
aws-sdk
: ^2.744.0
axios
: ^1.2.0
lodash
: ^4.17.20
mongoose
: ^6.8.0
mysql
: ^2.18.1
redis
: ^4.5.1
request
: ^2.88.2
bluebird
: ^3.7.2
random-number-csprng
: ^1.0.2
googleapis
: ^67.0.0
from [libraryname] import [item]
, such as from redis.client import redis
.
requests 2.28.2
@hubspot/api-client ^8
google-api-python-client 2.74.0
mysql-connector-python 8.0.32
redis 4.4.2
nltk 3.8.1
import
, such as import os
.
contacts
or forms
. Learn more about HubSpot private apps.
def main(event):
function is called when the code snippet action is executed.callback()
function is used to pass data back to the workflow. It should be called in the exports.main
function. This can only be used with Node.js.event
object will contain the following data:
OUTPUT_VALUES_TOO_LARGE
error.currentDate.setUTCHours(0,0,0,0)
catch
block of your custom code action.except
block of your custom code action.exports.main
function may be re-used for future executions of the custom code action. This is useful when connecting to external services like a database, but any logic or information that needs to be unique to each execution of the custom code action should be inside the exports.main
function.def main
function may be re-used for future executions of the custom code action.
def main
function but do not plan on altering it, you can reference the variable directly.def main
function with a global keyword before referencing it.