Prerequisites
- Configure a Click To Call Widget.
- Edit access to the HTML content of your website.
Embed the Click To Call Widget
Copy the code from the Endpoint settings
- Go to Deploy > Endpoints and select the Voice Gateway Endpoint you previously configured the Click To Call widget for.
-
In the Click To Call Embedding HTML field of the Endpoint settings, hover over the code editor and click the Copy to clipboard button to copy the HTML code. The HTML code includes the following entities:
- The Click To Call JavaScript bundle โ hosted externally on GitHub.
- The
addEventListener()function โ waits for the page to fully load, then initializes the Click To Call widget withinitWebRTCWidget(), if it exists. TheinitWebRTCWidget()function is called with a single argument, which is the configuration URL of the Voice Gateway Endpoint to connect to. This embedding code contains the necessary JavaScript code to initialize and display the Click To Call widget on your website.
<ENDPOINT_URL> and <YOUR_ENDPOINT_CONFIG_TOKEN> are the URL and the Endpoint configuration token, respectively. For example, https://endpoint-dev.cognigy.ai/ab8b929039b427fed7ee84bb799acd7f254fc9254be27c87a78fc8a70fb048ec for the development environment or https://endpoint.cognigy.ai/ab8b929039b427fed7ee84bb799acd7f254fc9254be27c87a78fc8a70fb048ec for the production environment.Customize the Click To Call Widget
You can customize the Click To Call widget by extending the widget script, according to your requirements:- Add event handling and callbacks.
- Use API methods for sending and receiving data.
- Customize the CSS styles and branding of your Click To Call widget.
Configure Multimodal Communication
To configure multimodal communication for your voice AI Agents, use the Click To Call API.Configure Multimodal Input Fields
Configure Multimodal Input Fields
To open and close input fields on your website, you need to use the following from the Click To Call widget API:
widget.on('newRTCSession', callback)โ uses the session from the callback to attach the following events.session.on('newInfo', callback)โ reads the INFO body from the Flow. Use this method to open input fields. For example, add this method to listen for the"openInputField": trueproperty and open the input field by sending this property in the Data field of a Say, Question, or Optional Question Node.session.on('ended', callback)โ close the input field when the call ends.session.on('terminated', callback)โ close the input field when the session is terminated.