Utility Functions

Helper functions or one-off functions that don't have a category yet
Utility functions are a mix of helper functions or one-off functions that don't have a category yet. They contain functions that range from helping you debug and test your API endpoint, to functions that help you enforce.
  • Preconditions - Set conditions that must be true If not met, the request will stop.
  • HTTP Header - Set a custom HTTP Header for the API endpoint.
  • Sleep - Pause the execution of the function stack for a period of time.
  • Get All Input - Used for Webhooks
  • Get All Environment Variables - Pull all environment variables into a single object
  • Calculate Distance - Map the latitude and longitude from two different points.
  • Stop & Debug - Stop the execution of the function stack and print out a value.
  • Return - Return a result and exit the function stack.

Preconditions

Preconditions are useful if you want to enforce that something is true and create an error message in the event it is not true.
Set conditions that must be true If not met, the request will stop. You can also specify an error message below.

HTTP Header

Set a custom HTTP header.

Sleep

Pauses execution of the Function stack and goes to sleep. (Think of it like waiting or pausing to execute).
In this example, the Sleep function is set to pause for 5 seconds.

Get All Input (Webhooks)

Gets The input from a Webhook and makes it available to use in the Function stack. For more information, see the Webhooks section.

Get All Environment Variables

The Get All Environment Variables function
This function will gather all environment variables of your workspace and populate a single object with them. This allows you to more quickly access your environment variables using the GET filter, instead of manually populating them where they are needed elsewhere in your function stack.
In this example, we have 3 environment variables in our workspace. By using Get All Environment Variables, we can populate all of these in a single variable for easier access.
We can then use the GET filter to access each variable. For this example, we are populating a URL parameter for an API request.

Calculate Distance

Calculate the distance between two longitude/Latitude points

Stop & Debug

Stops execution of the Function Stack at a specified point and prints out the data. (This can be advantageous when testing and debugging complex logic in the Function Stack).
In this example, the specified value for Stop & Debug to print out is the variable "merchant."
In this example, Stop & Debug is inserted in the Function Stack where we wish to stop execution. Additionally, the specified data is printed out at the point where execution was stopped.

Return

Return will return a result and exit the Function Stack. Return can be especially useful with conditional logic that requires you to return something as soon as you have a certain result.
In this example, the Return function is shown in the response due to the condition that was met, despite var: result being defined in the response.