Steps to Set Up Web Call Package on Websites
-
Create a New Agent for Web Calls
To use an agent on your website, you need to create a new agent with thewebcallcapability. You can create a new agent using this /api/agent/create_new_agent endpoint. Ensure you includeweb_configintelephony_providersto enable web call capabilities. -
Import the Web Call Package
You can import the package via our CDN by adding the following script tag to your HTML file.Ensure you use thedeferattribute in the script tag to ensure that the script is executed after the document has been parsed. -
Make a call from the website
Additional Features
-
Microphone Selection
You can select a microphone by callingsetMicrophone(<deviceId>). You can get thedeviceIdusing native browser audio API or via callinggetMicrophones().Microphone selection is optional. If not specified, the default microphone of the host machine will be used. -
Setting Dynamic values for a call
{your_variable_name} in the prompt.
setPromptValues({name: "Bob"}) method. These values will be substituted in the initial_text and prompt.
Call the
setPromptValues method before starting the conversation; otherwise, the values will not be substituted.-
Transfer web call to a phone call
transfer_calls action under the actions configuration. This allows the system to route calls from the web to a specified phone number.
To enable the transfer_calls action, you need to call the /api/agent/update-voice-agent endpoint with the following payload:
number_dict: A JSON object which will contain key pair of name and a phone number. If the user asks to transfer the call to bob then the keylegalwill be the phone number to which the call will be transferred. This is helpful in scenarios where you want to transfer the call to different departments based on the user’s request. If user doesn’t mention any department then the call will be transferred to the number mentioned in thedefaultkey.user_message: A message bot will respond with before transferring call. [OPTIONAL]