Learn how to connect a Dialogflow ES agent to outbound calls. If you need to connect inbound calls to your Dialogflow agent, please examine the How to Use Dialogflow ES with Inbound Calls how-to.
Setting up Dialogflow
Re-check that your Dialogflow agent uses API V2. Now create and download the service account JSON file associated with the agent from GCP console (please read the Setting up authentication article for details). "Dialogflow API Client" role should be chosen while creating the service account. The JSON file is required for Voximplant to be authorized before sending audio data to the agent.
Click on the Speech tab in the agent settings to setup Speech synthesis options.
Enable Automatic Text to Speech by clicking on the toggle button, choose MP3 or OGG in the Output Audio Encoding dropdown (IMPORTANT: only MP3 and OGG are currently supported) and one of the available voices - we highly recommend you to use WaveNet-powered voices, since they sound much better than standard ones. Save settings by clicking the Save button in the top right corner.
Setting up Voximplant
In the Voximplant control panel, go to your application and switch to the Dialogflow connector tab. Here, click Add in the center of the screen or Add Dialogflow agent in the upper right corner.
The Add Dialogflow agent dialog will appear, click the Choose a file button or drag'n'drop the JSON file downloaded from GCP console and click the Add button. After the file has been uploaded you will see a newly added agent in the list:
To make calls to the phone network from Voximplant, a real phone number is required, since it will be used as a caller ID. Create an app in the Voximplant control panel and a scenario inside the app, then buy a phone number and attach it to this app. After that, create a Rule that will forward all the calls from the number you bought to the scenario.
If you've chosen the number in the country where no special verification is required (for example, in the United States) then you will be able to make calls straight away, otherwise, there will be a notification to upload verification documents required by the authorities in the country. It will take some time until the number becomes active if all the submitted verification documents are correct.
The scenario should look like this:
You can initiate a call programmatically via the StartScenarios method of the HTTP API. Or you can run the rule from the Control Panel: being in your application, switch to Routing on the left menu and click Run rule:
The "Run rule" dialog will be displayed. In the dialog specify a callee's phone number in Script Custom Data and click the Run rule button to initiate a call.
If everything was done correctly, the call will arrive to the specified phone number and you will hear a greeting from your agent.