The AI Function allows you to connect AI integrations to your automation processes and any external tools. With the AI Function, you can easily collect user data and trigger workflows. The workflows you initiate can run any automation, retrieve data from other systems, and return that data to the AI integration.
For example, if a user asks, “What is the weather like in New York?” the AI doesn’t have access to real-time data and won’t be able to answer the question. However, with the AI Function, you can trigger an automation that fetches data from any Weather API.
The AI Function is also effective for gathering information to qualify leads. For instance, if you are a real estate agent, you could use the AI Function to automatically collect any information you need when a user shows interest in buying a home.
Chatrace has implemented an AI Function ( “connect_user_to_human”) that transfers the conversation to a human agent. This Function is currently active on all accounts.
How to create an AI Function
Navigate to AI Center > AI Tools > AI Functions

On the AI Function page, click the Add Button

Name:The name of your AI function should clearly describe its purpose. For example, instead of using “weather” as a name, use “get_current_weather.” Always try to include at least two words in the trigger name.
What does this trigger do?
This section should further clarify the purpose of the AI function. Always start with “Allows the user to…” For example, “Allows the user to book an appointment.” There is no need to specify what data should be collected in this section.
What data to collect?
The name of the data you intend to collect should be clear and meaningful. For instance, if you want your trigger to collect the user’s email address, use “email” rather than a random name like “AAAAAA.” The AI function will not understand what “AAAAAA” represents.
What flow is triggered?
This step is necessary only if you want to trigger a flow that processes the collected data or activates an automation. For the best user experience, if the response relies on the collected data, set the response in a single custom field and use it in the “What is the output message?” section.
What is the output message?
The result of triggering this AI Function. For example, “Your booking was confirmed”. The output message will not be sent exactly as specified. AI will rewrite and send it to the user. We strongly recommend not sending the message directly from the flow builder. Instead, set your message on a text custom field and use the custom field as an output message.
Below are some examples of AI Functions.
Name: book_appointemt
What does this trigger do?:
Allows the user to book an appointment.
What data to collect?:
date, email, reason
What is the output message?
You have successfully booked an appointment.
Name: connect_user_to_human
What does this trigger do?: Allows the user to speak, talk or contact a human agent or team. This function will connect the user to a human agent.
What flow is triggered?
Trigger a flow that includes an Inbox Action that moves a conversation to a human.
What is the output message?
You are now connected to a human agent. We will get back to you soon.
Name: get_current_weather
What does this trigger do?: Allows the user to get the current weather in a given location
What data to collect?:
city
What flow is triggered?
Trigger a flow that you will connect to a Weather API using External Request.
What is the output message?
{{data_from_api}}
Name: join_email_list
What does this trigger do?:
Allows the user to join our email list.
What data to collect?:
email
What is the output message?
Success
Name: request_shipping_quote
What does this trigger do?:
Allows the user to request a quote for shipping a package.
What data to collect?:
origin_address, destination_address, dimensions, weight
What flow is triggered?
Trigger a flow that you will calculate a quote based on the data collected.
What is the output message?
{{quote}}
Enabling/Using AI Function
After you create your AI Function, enable it on the AI action or AI Agent.

Important notes
Your prompt can influence how your AI function operates. For instance, during our tests, we observed that the AI sometimes attempts to automatically fill in parameters if the user does not provide them. For example, if you have a restaurant reservation trigger, you could include in your prompt, “It is crucial to ask the user for the date and number of guests when making a reservation.”