Contact Sales

All fields are required

Create a Serverless Receptionist with SignalWire AI Agent | SignalWire
Developers

Create a Serverless Receptionist with SignalWire AI Agent

Exploring a code snippet for an AI agent

Len Graham

A serverless receptionist can be built entirely inside the SignalWire dashboard using SignalWire AI Agent, with no external servers to host call logic. This guide breaks down a JSON configuration that defines the receptionist’s prompts and parameters, post-prompt behavior, supported languages and voices, and SignalWire AI Gateway (SWAIG) functions that let the agent transfer calls to predefined destinations when needed.

The realm of customer service is changing rapidly, and having a reliable and efficient receptionist is crucial. With SignalWire AI Agent, conversational AI can be implemented to configure a virtual assistant to handle tasks and initial interactions with customers.

SignalWire AI Agent is a powerful tool for anyone looking to enhance customer support operations with smarter voice applications, and now it can be used without the need for external servers. The elimination of external servers allows anyone to easily build an AI receptionist, which can otherwise require significant time and resources. A virtual agent can be built entirely within the SignalWire dashboard.

In this post, we'll dive into the code of a JSON configuration snippet that outlines the behavior of the serverless receptionist for customer support. You can use this snippet to configure an agent to serve as your virtual receptionist, handling customer inquiries with the option to transfer the calls.

AI Configuration: prompts and parameters

{
 "version": "1.0.0",
 "sections": {
 "main": [
 {
 // AI configuration details will go here
 }
 ]
 }
}


Configuring an AI agent involves defining various aspects of their behavior, such as prompts, functions, and supported languages. This JSON configuration example offers insights into how a customer support AI assistant can be configured to handle calls and interactions.

The configuration starts with a version identifier and a nested structure named "sections." Inside "sections," you’ll find the main section where all AI configurations will reside. The configuration sections will contain all the information to customize the behavior of your virtual assistant, including your prompt and parameters.

{
 "ai": {
 "post_prompt_url": "https://webhook.site/1c67cc27-311e-4dff-a50a-435cb887f304",
 "params": {
 // Parameters for AI behavior
 },
 "prompt": {
 // Initial greeting and behavior instructions for the assistant
 },
 "SWAIG": {
 // AI functions and settings related to call handling
 },
 "post_prompt": {
 // Behavior after the conversation ends
 },
 "languages": [
 // Supported languages for the assistant
 ]
 }
}


The AI section contains various settings and instructions that shape the AI assistant's behavior. Here's a breakdown of the components:

  • post_prompt_url: The URL where the assistant can send data after prompts.

  • params: Parameters influencing AI behavior, such as debug settings and time zone.

  • prompt: Instructions for the initial greeting and behavior of the assistant, including confidence levels and response characteristics.

  • SWAIG: Functions and settings related to call handling, including a transfer function and associated data mappings.

  • post_prompt: Instructions for behavior after the conversation ends.

  • languages: List of supported languages along with their voice settings.

SWAIG and the transfer function

"functions": [
 {
 "meta_data": {
 "target_table": {
 "jim": "+17247231200",
 "abc": "+12345678910"
 },
 "function": "transfer",
 "data_map": {
 // Expressions for call transfer
 },
 "argument": {
 // Definition of the 'target' argument
 },
 "purpose": "use to transfer to a target"
 }
]


The SignalWire AI Gateway (SWAIG) enables functions allowing the voice agent to perform actions. Within the SWAIG section, this code snippet defines a function for transferring calls. This function includes:

  • meta_data: A metadata section containing target phone numbers for transfer.

  • function: Specifies that this is a transfer function.

  • data_map: Expressions to control the transfer process based on conditions.

  • argument: Definition of the 'target' argument that specifies the transfer destination.

  • purpose: Describes the purpose of the function.

Supported languages

"languages": [
 {
 "code": "en-US",
 "voice": "gcloud.en-US-Standard-A",
 "name": "English (US)"
 },
 {
 "code": "es-US",
 "voice": "gcloud.es-US-Standard-B",
 "name": "Spanish (US)"
 }
]


The AI Agent is designed to cater to a diverse audience and supports multiple languages, each with a language code, voice setting, and name. US English and US Spanish are used in the example.

Full example code snippet

SignalWire AI Agent eliminates the need for external servers and streamlines your entire setup within your SignalWire space. With this powerful tool at your disposal, you can provide top-notch customer support quickly and easily. Below, you can see the full code example for a serverless virtual receptionist, and use it to build your own.

{
 "version": "1.0.0",
 "sections": {
 "main": [
 {
 "ai": {
 "post_prompt_url": "https://webhook.site/1c67cc27-311e-4dff-a50a-435cb887f304",
 "params": {
 "debug_webhook_url": "https://webhook.site/1c67cc27-311e-4dff-a50a-435cb887f304",
 "debug_webhook_level": "true",
 "local_tz": "America/Chicago"
 },
 "prompt": {
 "text": "Your name is John and you are a Customer Support virtual assistant. Begin by greeting the caller. You can transfer to jim if asked. Business hours are Monday thru Friday 9:00AM EST thru 5:00PM EST. If asked, the fax number is 12345678911. If the caller wants a human during business hours transfer to abc.",
 "confidence": 0.1,
 "top_p": 0.1,
 "temperature": 0.1
 },
 "SWAIG": {
 "functions": [
 {
 "meta_data": {
 "target_table": {
 "jim": "+17247231200",
 "abc": "+12345678910"
 }
 },
 "function": "transfer",
 "data_map": {
 "expressions": [
 {
 "output": {
 "action": [
 {
 "say": "Please stand by while I connect your call."
 },
 {
 "SWML": {
 "version": "1.0.0",
 "sections": {
 "main": [
 {
 "connect": {
 "to": "${meta_data.target_table.${lc:args.target}}"
 }
 }
 ]
 }
 }
 },
 {
 "stop": "true"
 }
 ],
 "response": "transferred, the call has ended."
 },
 "pattern": "\\w+",
 "string": "${meta_data.target_table.${lc:args.target}}"
 },
 {
 "pattern": ".*",
 "string": "${args.target}",
 "output": {
 "response": "I'm sorry, I was unable to transfer your call to ${input.args.target}."
 }
 }
 ]
 },
 "argument": {
 "type": "object",
 "properties": {
 "target": {
 "description": "the target to transfer to",
 "type": "string"
 }
 }
 },
 "purpose": "use to transfer to a target"
 }
 ],
 "post_prompt": {
 "text": "Summarize the conversation",
 "top_p": 0,
 "temperature": 0
 },
 "languages": [
 {
 "code": "en-US",
 "voice": "gcloud.en-US-Standard-A",
 "name": "English (US)"
 },
 {
 "code": "es-US",
 "voice": "gcloud.es-US-Standard-B",
 "name": "Spanish (US)"
 }
 ]
 }
 }
 }
 ]
 }
}


Try out SignalWire AI Agent for free by using code SWAIG when you sign up for a SignalWire account! As you build your new AI Agent, bring any questions to the team on Discord.

Frequently Asked Questions

What is a serverless receptionist?

A serverless receptionist is an AI voice agent configured to answer calls, handle basic customer interactions, and optionally transfer callers, without running your own application server to host call logic.

How do you configure a receptionist in SignalWire AI Agent?

You configure the receptionist by editing a JavaScript Object Notation (JSON) configuration that defines the agent’s prompt, parameters, supported languages, and post-prompt behavior.

What is SignalWire AI Gateway (SWAIG), and why is it used?

SignalWire AI Gateway (SWAIG) enables functions that let the AI Agent take actions during a call, such as transferring the caller based on conditions and inputs.

How do supported languages work in SignalWire AI Agent?

Supported languages are listed in the configuration with language codes and voice settings, allowing the agent to respond using the specified languages and voices, such as US English and US Spanish in the example.

Related Articles