How to Connect Voximplant and Google Dialogflow to Build AI-Powered Interactive Voice Responses
Learn how to connect Voximplant and Google Dialogflow to build AI-powered interactive voice responses.
Join the DZone community and get the full member experience.Join For Free
Google Dialogflow is a powerful development suite that allows developers to create conversational interfaces for websites, mobile apps, major messaging platforms, and IoT devices. By using its machine learning and natural language understanding (NLU), Dialogflow (formerly API.AI) can facilitate the creation of robust interactive voice response (IVR) interactions, complete with the ability to understand the intent and conversational context of users as they speak. Dialogflow also provides speech-to-text translation, slot filling to easily build dialog rules for dynamic conversations, and other features that help enrich the experience that AI agents can deliver. Overall, Dialogflow allows developers to more quickly and capably prepare AI-based interfaces that serve users in a natural, conversational, and human style.
Introducing Dialogflow Connector
To enable developers to realize the full benefits of Google Dialogflow for telephony use cases, we’ve created a Dialogflow Connector as a new tool that rather simply integrates the development suite with Voximplant’s telephony platform. Using Dialogflow Connector, developers can combine Voximplant’s call handling with a Dialogflow agent’s speech recognition and NLU processing logic and capabilities. With Dialogflow Connector in place, call audio streams from Voximplant to Dialogflow in real-time, and query results are ready for processing as quickly as the agent returns them. All that’s necessary for this scenario to function is to switch your Dialogflow agent to the V2 API — as detailed in this migration guide — as the V1 API lacks streaming support.
How to Set Up Dialogflow
Once switched to the V2 API, download your agent’s service account JSON file from Google Cloud Console (this article covers how to set up Google Cloud Platform Service Account authentication). This JSON file is a prerequisite that authorizes Voximplant to send audio data to the agent.
How to Set Up Voximplant
A Voximplant application can only be associated with a single Dialogflow agent. Within the Voximplant control panel, click Settings on the top menu, and select Dialogflow Connector.
Next, click the Add Service Account link from the left menu. Then, click on the Choose file button, and select the JSON file you downloaded from GCP console. Clicking the Bind app button will bind the service account to one of your applications. Pick the application you want to bind from the drop-down list and click Save. You’ve now bound the Dialogflow agent to your Voximplant application.
The AI module within Voximplant can now send call media to the Dialogflow agent.
In the example above, media from the inbound call is sent to the Dialogflow agent, and query results are returned in DialogflowQueryResult events. In this simple scenario, Voximplant says the fulfillmentText from the Dialogflow agent and then waits until the caller speaks a new phrase. In this code, DialogflowQueryResult represents Dialogflow's QueryResult object.
To experience a more concrete example of Dialogflow Connector and get a taste of how it feels to order a pizza by phone from an AI, give it a try.
Opinions expressed by DZone contributors are their own.