Sign Up
Loading...

Functions

Watch the walkthrough

Custom Functions

Create reusable server-side functions and call them from workflows.

Recorded with an earlier Twidget interface. Names, control locations and available options may differ; use the linked documentation for current guidance.

Watch tutorial (3:13)

Browse all video tutorials

In Twidget, you can build custom reusable functions. These functions can be utilized across various sections including endpoints, events, and other functions. Instead of creating the same commands repeatedly, you can create a function once and reuse it wherever necessary, making your workflow more efficient and maintainable.

Constructing Functions

Functions in Twidget are structured similarly to endpoints. However, instead of using typical endpoint inputs such as query, headers, and body, functions use data type inputs.

Inputs

Functions require specific data type inputs to operate. These inputs are defined in the inputs section of the function.

Output

Each function also has an optional output. To simplify the use of functions, you can define an output schema. The output schema acts as an internal documentation detailing what the output of the function will look like. This makes it easier to understand and utilize the function correctly.

Managing Custom Functions

All custom functions you've created can be viewed in the Your Functions section of the Add Commands sidebar. This centralized view allows you to easily manage and access your reusable functions.

Using Custom Functions

When you need to use a custom function that has inputs, you will be prompted to enter the required inputs in the Commands sidebar. This ensures that the function has all the necessary data to execute correctly.

Run shared logic automatically

Use Reusable Middleware when shared logic should run before or after endpoints, functions or events, including through workspace defaults. Use an ordinary custom function when you want to choose its call explicitly inside your command list.

Save a reusable starting point

Use Workflow templates to keep a function and its supported dependencies in your workspace library. Installing a template creates independent unpublished copies that you can adapt and test before publishing.

Related Topics

Safer Releases

Move a reviewed set of published workflows from a Dev workspace to a Prod workspace. Releases let you review the changes together, keep a release history and review a rollback if you need to restore the previous workflows. Prepare your workspaces. Use two existing workspaces in the same organization...

Command Output

Some commands in Twidget return outputs, which are essential for dynamic and conditional logic within your workflows. These outputs are displayed next to the command and are prefixed with an "as" to indicate the variable name. Using Output Variables. Once a command returns an output, you can use the...

Variables

Variables are essential building blocks in Twidget that allow you to store and manipulate data dynamically within your no-code applications. They enable you to create flexible and interactive applications by holding values that can be changed and referenced throughout your workflow. Creating Variabl...

Dynamic variables in JSON and text

Build JSON bodies and messages using values from your workflow. The Insert variable picker lets you choose inputs, earlier command results, nested object fields and list items without typing their references. Choose a nested field or list item. 1. Open a command value or function output and choose J...

Working on smaller screens

Twidget adapts its navigation, lists and editing panels to phones, tablets and smaller laptop windows. You can use the same workspace and saved workflows across these views. Open your workspace tools. On a phone, use the menu button at the top to open workspace navigation. Choose a tool from Build, ...