We’re currently experiencing a high volume of support requests, which may result in longer response times — thank you for your patience and understanding.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This documentation is for the new preview UI. It’s still being refined and is subject to change. For documentation for the old UI, see Knowledge Base.

Article link copied to clipboard
Updated
Published
2 min read

Author and run your own code

Connections

API Key

API Key connection

Input Comments Default
API Key API Key

API Key Secret

API Key Secret connection

Input Comments Default
API Key API Key
API Secret API Secret

Basic Username/Password

Basic Username and Password connection

Input Comments Default
Username Username
Password Password

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.

Input Comments Default
Authorize URL The OAuth 2.0 Authorization URL for the API
Token URL The OAuth 2.0 Token URL for the API
Scopes Space separated OAuth 2.0 permission scopes 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

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.

Input Comments Default
Token URL The OAuth 2.0 Token URL for the API
Scopes Space separated OAuth 2.0 permission scopes 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 token requests

Private Key

Private key connection

Input Comments Default
Username Username
Private Key Private Key

Triggers

Code Block Trigger

Author and run your own code as a trigger

Input Comments Default
Code The 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

Input Comments Default
Code The 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 };
};