Skip to main content

Code Connector

Code Author and run your own code

Connections

API Key

API Key connection

InputCommentsDefault
API KeyAPI Key

API Key Secret

API Key Secret connection

InputCommentsDefault
API KeyAPI Key
API SecretAPI Secret

Basic Username/Password

Basic Username and Password connection

InputCommentsDefault
UsernameUsername
PasswordPassword

OAuth 2.0 Authorization Code

OAuth 2.0 Authorization Code flow

This connection uses OAuth 2.0, a common authentication mechanism for integrations. Read about how OAuth 2.0 works here.

InputCommentsDefault
Authorize URLThe OAuth 2.0 Authorization URL for the API
Token URLThe OAuth 2.0 Token URL for the API
ScopesSpace separated OAuth 2.0 permission scopes for the API
Client IDClient Identifier of your app for the API
Client SecretClient Secret of your app for the API
HeadersAdditional header to supply to authorization requests

OAuth 2.0 Client Credentials

OAuth 2.0 Client Credentials flow

This connection uses OAuth 2.0, a common authentication mechanism for integrations. Read about how OAuth 2.0 works here.

InputCommentsDefault
Token URLThe OAuth 2.0 Token URL for the API
ScopesSpace separated OAuth 2.0 permission scopes for the API
Client IDClient Identifier of your app for the API
Client SecretClient Secret of your app for the API
HeadersAdditional header to supply to token requests

Private Key

Private key connection

InputCommentsDefault
UsernameUsername
Private KeyPrivate Key

Triggers

Code Block Trigger

Author and run your own code as a trigger

InputCommentsDefault
CodeThe code to be executed/
Access config variables by name through the configVars object. e.g.
const apiEndpoint = ${configVars["App Base URL"]}/api;

Access the trigger payload using the payload argument. This includes
headers, the body of the request, and more information about the request.

You can return string, number or complex object data. e.g.
return { payload: { foo: "Hello", bar: 123.45, baz: true } };

You are also able to return an optional response to the webhook caller.
For example, you can respond with a CSV response like the following:
return {
payload: { foo: "Hello", bar: 123.45, baz: true },
response: { statusCode: 200, contentType: "text/csv", body: "hello,world" },
}
/

module.exports = async ({ logger, configVars }, payload) => {
const response = {
statusCode: 200,
contentType: "text/plain",
body: "hello",
};
return { payload, response };
};

Actions

Code Block

Author and run your own code

InputCommentsDefault
CodeThe code to be executed/
Access config variables by name through the configVars object. e.g.
const apiEndpoint = ${configVars["App Base URL"]}/api;

Access previous steps' results through the stepResults object. Trigger
and step names are camelCased. If the step "Get Data from API" returned
{"foo": "bar", "baz": 123}, you could destructure that data with:
const { foo, baz } = stepResults.getDataFromApi.results;

You can return string, number or complex object data. e.g.
return { data: { foo: "Hello", bar: 123.45, baz: true } };
/

module.exports = async ({ logger, configVars }, stepResults) => {
return { data: null };
};