Components and functions

They make your life easier!

What are they?

Components and functions are reusable bits of code that can be called from pages or webhooks. They reduce code repetition for recurrent features, tasks, or automations.

⚠️ Functions are not the same as triggers.

  • Triggers depend on Jestor internal actions and operate on $objectNew or $objectOld values when activated.
  • Functions receive information externally, activated by webhooks or automations, and operate on $data values. To return information (to a page or the next step in an automation sequence), you must send it back through the front-end — for example, using {{$data}}.

Creating a component / function

  1. Go to the Developer Area
  2. Click Components / Functions+ Create new function
  3. Name the function and press Create

After creation, you can customize the back-end and front-end in their designated consoles, call the function from customized pages, and assign specific webhooks to activate it.

Calling a function from a customized page

callFunction($functionname, $functionarguments, $render, $loading, $callback)

Parameters

ParameterDescription
$functionnameThe API/trigger name of the function
$functionargumentsA JSON object with arguments to pass into the function
$renderID of the HTML element that will receive the function's return. Pass null if not applicable
$loadingIf $render is set, pass true or false to show or hide the default loading indicator. Pass null if there is no render target
$callbackFunction that handles the return value of the executed component/function

Example — $functionarguments

{
  "id_client": 1,
  "items": ["item1", "item2"]
}