# Function

**Introduction**

The "Function" trigger allows you to define a custom function within your automation. This trigger is useful for encapsulating reusable logic and enabling other parts of your automation to call and execute it.

**Configuration**

* **Inputs**: A list of input parameters that the function can accept. Each input includes:
  * **Name**: The name of the input, used to identify it.
  * **Schema**: The data type of the input, selected from a list of user-definable types. This parameter is required.
* **Return**: Specifies the value that the function will return after execution. This parameter is optional and can be defined based on your automation's needs.

**Outputs**

* **Inputs**: An object representing the function's inputs that are received when the function is called. This output is generated only if you define inputs in the configuration.

This trigger enables modular and reusable code within your automation workflows, making it easier to manage complex logic.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flexy.bot/modules/scripting/triggers/function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
