Developers

Expanding SignalWire’s Call Flow Builder with an AI Agent

Easy AI agent integration with SignalWire's no-code Call Flow Builder

Technical Success Manager

Daniele Zils

How SignalWire Call Flow Builder and AI Agent work together

SignalWire's integration of an AI agent with Call Flow Builder opens up exciting possibilities for users seeking to enhance the capabilities of their voice applications by using AI in their call flows.

Call Flow Builder is an intuitive visual builder for organizing your incoming call flows. SignalWire AI Agent is a customizable AI-powered voice application that can function as a virtual assistant or receptionist. Together, you can use these tools to allow AI to take over your call flow, while using Call Flow Builder to map out the rest of the customer journey.

In this post, we’ll guide you through setting up a SignalWire AI Agent and configuring it to integrate with a database server to retrieve customer information, and then add it into Call Flow Builder. The possibilities for this integration are vast, with applications ranging from customer data collection to automated support solutions.

In this example, we'll keep things simple. Imagine a scenario where a customer calls to inquire about their upcoming appointment. The AI agent takes over the call to collect the customer's full name and date of birth. These details are used to fetch the appointment time from a database and then given to the caller.


To get started, you just need a SignalWire account and a verified phone number.

Setting up the AI Agent

To begin, navigate to AI agents in your SignalWire space. An AI agent needs to be configured independently before integrating with Call Flow Builder.

For this example, we’ll build our AI agent using plain text instructions. To do this, navigate to Add New, select the Advanced Configuration option and save your agent’s name.

Configuring the AI Prompt:

The prompt plays a pivotal role in setting the tone and context for customer interactions with an AI agent. This agent will be configured to provide customers with their appointment time and follow a specific conversational flow. To do this, the agent will look up a function to retrieve information from a database, and if the customer doesn’t have an appointment, they will be instructed to call the sales department.

If you need more information about how to set up a prompt, see the technical reference for definitions of advanced configuration options.

Below is the prompt defining the AI agent for this example:


Post-Prompt Text and URL:

Next, we’ll configure the Post-Prompt Text as: 'Summarize the conversation.'

The Post-Prompt URL is the destination where the AI agent sends responses upon completing its interaction. In this instance, we utilize a Webhook.site URL for monitoring these responses. We suggest you develop a customized webhook server to guarantee the security of client data.

After completing these configurations, save your progress and select a language for your AI agent on the next tab.

Server Setup

For this example, I've already set up a database script. You can clone this GitHub repository to replicate the desired behavior in our implementation. Follow the README guidelines to configure your server and use the database script as necessary.

Functions Tab Configuration

After setting up your server, navigate to the Functions tab of your SignalWire AI agent, and click on the Add Function button. Next, name your function and specify its purpose. This helps your AI agent understand when to access this particular function during interactions.

Arguments

In the Arguments section, define the parameters that your function requires to operate. These parameters will be gathered by the AI agent and used to access the function, retrieving the appointment time from the database.

Behind the scenes, these parameters are packaged within a JSON object and can be accessed through the parsed property of the argument object within the request sent to the URL.

For a more comprehensive understanding of this section, please refer to SignalWire’s developer resources.

For this function, you'll need to define the following parameters: the client's first name, last name, and date of birth.

Lastly, include the webhook URL for your function. SignalWire requires your webhooks to be publicly accessible for them to work with our services. As shown in the screenshot below, we’re using NGROK to make the endpoint accessible.

Once all configurations are complete, save both the function and any changes made to the AI agent.

Call Flow Builder Integration

To integrate the AI agent into a call flow, create your setup in the Call Flow Builder tab, and tailor your modules to your specific implementation.

The example below uses a simple Interactive Voice Response (IVR) system for this use case. If a customer presses '2,' they will be automatically connected to the AI agent known as 'Ally.'

After completing the design of your call flow, don’t forget to click the Deploy button located at the top of your canvas. Then you can access the settings of your designated phone number within your SignalWire Space. From the Handle Calls Using the dropdown menu, select Call Flow. In the When a Call Comes In dropdown, choose the title of the flow you've created, select a version of your build, and save your settings.

Now that your IVR is successfully deployed, you can put it to the test by making a call to your selected phone number.

SignalWire's AI agent effortlessly connects with server databases and integrates into Call Flow Builder. This practical integration streamlines processes and enhances customer interactions by allowing AI to take over the call flow.

If you have any questions as you get started with SignalWire AI Agent or Call Flow Builder, bring them to our community forum, Discord, or Slack!

Related Articles