Skip to main content

Code Component

Author and run your own code

Component key: code

Description

The code component allows you to write your own short snippets of JavaScript code, and is handy for writing quick functions or data transformations that are specific to your product or industry. Please see the full article on the code component for information on when a code component is appropriate, and common use cases for a code component.

Code component steps should be succinct and integration-specific. If the code you write could be reused in other integrations, if it needs to handle credentials, or if the code is complex enough that it would benefit from unit tests, etc., you should write a custom component instead.

For some examples of code component usage, check out these quickstart guides:

Connections

API Key

InputNotes
API Key
string
/ Required
apiKey
API Key

API Key Secret

InputNotes
API Key
string
/ Required
apiKey
API Key
API Secret
password
/ Required
apiSecret
API Secret

OAuth 2.0 Authorization Code

InputNotes
Authorize URL
string
/ Required
authorizeUrl
The OAuth 2.0 Authorization URL for the API
Client ID
string
/ Required
clientId
Client Identifier of your app for the API
Client Secret
password
/ Required
clientSecret
Client Secret of your app for the API
Headers
string
Key Value List
headers
Additional header to supply to authorization requests
Scopes
string
scopes
Space separated OAuth 2.0 permission scopes for the API
Token URL
string
/ Required
tokenUrl
The OAuth 2.0 Token URL for the API

Basic Username/Password

InputNotes
Password
password
/ Required
password
Password
Username
string
/ Required
username
Username

OAuth 2.0 Client Credentials

InputNotes
Client ID
string
/ Required
clientId
Client Identifier of your app for the API
Client Secret
password
/ Required
clientSecret
Client Secret of your app for the API
Headers
string
Key Value List
headers
Additional header to supply to token requests
Scopes
string
scopes
Space separated OAuth 2.0 permission scopes for the API
Token URL
string
/ Required
tokenUrl
The OAuth 2.0 Token URL for the API

Private Key

InputNotes
Private Key
text
/ Required
privateKey
Private Key
Username
string
/ Required
username
Username

Triggers

Code Block Trigger

Author and run your own code as a trigger | key: runCodeTrigger

InputDefaultNotes
Code
code
/ Required
code
The code to be executed

{
"payload": null
}

Data Sources

Code Block JSON Form

Author and run your own code as a JSON Form data source | key: runCodeJsonForm | type: jsonForm

InputDefaultNotes
Code
code
/ Required
code
The code to be executed
Connection
connection
connection
 
 
Context Value
data
contextValue
 

Code Block Object Selection

Author and run your own code as a object selection data source | key: runCodeObjectSelection | type: objectSelection

InputDefaultNotes
Code
code
/ Required
code
The code to be executed
Connection
connection
connection
 
 
Context Value
data
contextValue
 

Code Block Picklist

Author and run your own code as a picklist data source | key: runCodePicklist | type: picklist

InputDefaultNotes
Code
code
/ Required
code
The code to be executed
Connection
connection
connection
 
 
Context Value
data
contextValue
 

Code Block String

Author and run your own code as a string data source | key: runCodeString | type: string

InputDefaultNotes
Code
code
/ Required
code
The code to be executed
Connection
connection
connection
 
 
Context Value
data
contextValue
 

Actions

Code Block

Author and run your own code | key: runCode

InputDefaultNotes
Code
code
/ Required
code
The code to be executed

{
"data": null
}