Skip to main content

How to set up custom functions in AloAi Agents

Set up custom functions in AloAi Agents to automate tasks, connect APIs, and enhance real-time customer interactions.

Laarni D avatar
Written by Laarni D
Updated over 3 weeks ago

What are AloAi Agents' custom functions?

AloAi Custom Functions are user-defined features that allow AloAi Voice and Text Agents to communicate with external systems using APIs. These functions execute dynamic, real-time tasks such as fetching customer data, updating records, or confirming appointments—based on user input during conversations.

By integrating with APIs, AloAi agents can personalize user interactions and automate backend workflows, helping businesses boost responsiveness and efficiency.


What problems do custom functions solve?

Custom Functions enable real-time data retrieval and action execution, reducing manual tasks and delays in customer service. They bridge the gap between a user's question and operational systems like CRMs, booking platforms, or internal tools.

They solve:

  • The need for real-time, data-driven responses

  • Manual processing of customer inquiries

  • Gaps between conversational interfaces and operational systems


Who can use custom functions?

Business admins can set up, test, and manage custom functions. They control how variables are defined, which API endpoints are used, and how responses are mapped.

Average users benefit from a smarter, more interactive experience with the assistant. Instead of canned replies, users receive responses informed by real-time data.


When should you use custom functions?

Use Custom Functions when your AloAi agent needs to interact with real-time external data or trigger backend actions during a conversation. Below are common use cases for both Text and Voice Agents.

AloAi Text Agents

  1. Self-service answers from live data

    Use a function to automatically pull policy information, pricing, or order status from your support systems.

    Example: When a user asks, “What’s your return policy?”, the agent uses a function to fetch the latest policy from your knowledge base.

  2. Lead capture and qualification

    Automatically follow up with missed callers or new inquiries by asking for key lead details (e.g., business size). Based on their answers, the function can update your CRM or route the lead to sales.

  3. Appointment booking via text

    Connect the agent to your scheduling tool. Users can check available slots and confirm bookings without agent assistance—all done through a triggered API call.

  4. Personalized marketing responses

    If a user asks about promotions, the agent can call a function to pull applicable offers from your CRM and reply with tailored content or follow-up actions (e.g., sending a discount code).

AloAi Voice Agents

  1. Smart call routing and IVR

    Voice Agents can handle routing using logic from your internal systems.

    Example: If the caller says “billing,” a function determines the right department and handles the transfer.

  2. Missed call follow-up

    When no one is available to take the call, use a function to log the details and send a follow-up via SMS or email—ensuring no inquiry is lost.

  3. Legal and consulting intake

    Voice Agents can pre-screen callers by collecting case or inquiry details. The function forwards this data to your intake system for review by your team.

  4. Outbound sales and booking

    For sales development (SDR/BDR) tasks, Voice Agents can call leads, assess interest using a function, and schedule meetings directly in your calendar.


Creating and applying a custom function

  1. Adding a new custom function

    1. To create a function, go to your AloAi Agent (Voice or Text) and navigate to the Custom Functions tab.

    2. Click +Add Function.

    3. Configure your custom function

      Name it and describe what it does. The description helps the agent understand when to use this function and what to say when it’s called.

    4. Additional settings

      Respond to the contact during execution - enable this option if you want the agent to provide audible feedback while executing the function. This is particularly helpful if the execution takes longer than 3 seconds.

      Respond to the contact after execution - enable this option if you want the agent to communicate with the contact after the function has completed.


Additional settings

  1. Define your variables

    Determine the pieces of information you need (e.g., CustomerFirstName, CustomerLastName, CustomerEmail).

    Each variable should have a type (string, number, etc.) and indicate whether it is required for execution.

    • CustomerEmail - string, required

    • CustomerLastName - string, required

    • CustomerFirstName - string, required

    Define your variables

  2. Setup the API request

    Select the appropriate method for your request based on your API requirements.

    In this example, a POST request is recommended for creating new resources. However, if POST is unavailable, you may opt for a GET request to retrieve data instead.

    Setup the API request

    Method available:

    • GET - used to retrieve data from the server. It does not modify any resources and is typically safe and idempotent.

    • POST - utilized to create new resources on the server. It submits data to be processed and can result in a change in the server's state.

    • PUT - employed to update an existing resource entirely. It replaces the resource with the request payload and is idempotent.

    • DELETE - used to remove a specified resource from the server. This method is idempotent, meaning repeated requests will have the same effect.

    • PATCH - similar to PUT, but it is used to apply partial modifications to a resource. It updates only the fields provided in the request.

    Add parameters - add any necessary query parameters or body data that your API endpoint requires.

    Examples of JSONs:

  3. Execute the function and test the API call

    Connect and send data - use the defined function to send the prepared data to the API, simulating the request as needed. Ensure that you provide real data values during testing.

    Connect and send data

  4. Handle API responses

    1. Set up response handling - define how to handle the data returned from the API.

      Set up response handling

    2. Map the response to the relevant fields in your application.

      Example: Map field ProductMessage in response to RecordStatus from API response.

      Map the response to the relevant fields in your application.

  5. Save and test your function

    Ensure to save your function once all parameters and settings are configured properly.

    Save and test your function

  6. Integrate with user interactions

    Integrate the function into user prompts - specify when the custom function should be called based on user queries (e.g., if a user asks about Cancel Customer Reservation or Account).

    Add action > Custom function

    Add action > Custom function

    Select custom function

    Select custom function

    Example:

    If the user asks about the cancel reservation:

    • Add action - cancel customer account

    • Specify which custom function to use

    Integrate with user interactions

Did this answer your question?