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
| Input | Notes | Example |
|---|---|---|
| API Key | API Key |
API Key Secret
| Input | Notes | Example |
|---|---|---|
| API Key | API Key | |
| API Secret | API Secret |
OAuth 2.0 Authorization Code
| Input | Notes | Example |
|---|---|---|
| Authorize URL | The OAuth 2.0 Authorization URL for the API | |
| Client ID | Client Identifier of your app for the API | |
| Client Secret | Client Secret of your app for the API | |
| Headers | Additional header to supply to authorization requests | |
| Scopes | Space separated OAuth 2.0 permission scopes for the API | |
| Token URL | The OAuth 2.0 Token URL for the API |
Basic Username/Password
| Input | Notes | Example |
|---|---|---|
| Password | Password | |
| Username | Username |
OAuth 2.0 Client Credentials
| Input | Notes | Example |
|---|---|---|
| Client ID | Client Identifier of your app for the API | |
| Client Secret | Client Secret of your app for the API | |
| Headers | Additional header to supply to token requests | |
| Scopes | Space separated OAuth 2.0 permission scopes for the API | |
| Token URL | The OAuth 2.0 Token URL for the API |
Private Key
| Input | Notes | Example |
|---|---|---|
| Private Key | Private Key | |
| Username | Username |
Triggers
Code Block Trigger
Author and run your own code as a trigger | key: runCodeTrigger
| Input | Notes | Example |
|---|---|---|
| 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
| Input | Notes | Example |
|---|---|---|
| Code | The code to be executed | |
| Connection | ||
| Context Value |
Code Block Object Selection
Author and run your own code as a object selection data source | key: runCodeObjectSelection | type: objectSelection
| Input | Notes | Example |
|---|---|---|
| Code | The code to be executed | |
| Connection | ||
| Context Value |
Code Block Picklist
Author and run your own code as a picklist data source | key: runCodePicklist | type: picklist
| Input | Notes | Example |
|---|---|---|
| Code | The code to be executed | |
| Connection | ||
| Context Value |
Code Block String
Author and run your own code as a string data source | key: runCodeString | type: string
| Input | Notes | Example |
|---|---|---|
| Code | The code to be executed | |
| Connection | ||
| Context Value |
Actions
Code Block
Author and run your own code | key: runCode
| Input | Notes | Example |
|---|---|---|
| Code | The code to be executed |
{
"data": null
}