Skip to main content

Steps to Set Up Web Call Package on Websites

  1. Create a New Agent for Web Calls

    To use an agent on your website, you need to create a new agent with the webcall capability. You can create a new agent using this /api/agent/create_new_agent endpoint. Ensure you include web_config in telephony_providers to enable web call capabilities.
  2. 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 the defer attribute in the script tag to ensure that the script is executed after the document has been parsed.
  3. Make a call from the website

Additional Features

  1. Microphone Selection

    You can select a microphone by calling setMicrophone(<deviceId>). You can get the deviceId using native browser audio API or via calling getMicrophones().
    Microphone selection is optional. If not specified, the default microphone of the host machine will be used.
  2. Setting Dynamic values for a call

If there is dynamic data that will change depending on the user’s information or other factors, you can set dynamic values for the prompt. When you create the agent, any dynamic value can be set by placing it in curly braces {your_variable_name} in the prompt.
You can set the dynamic values using the 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.
  1. Transfer web call to a phone call

You can transfer an ongoing web call to a phone call by enabling the 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:
Explanation of Fields
  • 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 key legal will 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 the default key.
  • user_message: A message bot will respond with before transferring call. [OPTIONAL]